# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/jtbb/ljsj_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["res"]
#     res = "|井号|井深m|钻时min/m|全烃%|甲烷%|硫化氢%|泥浆密度g/cm3|泥浆粘度s\n"
#     res = res + "|---" * 8 + "|\n"
#     count = 0
#     for x in data:
#         print(x)
#         if count % 50 == 0: #每50个获取一个
#             res = res + "|" + "|".join(x) + "|\n"
#         count += 1
#     return {
#         "result": res,
#     }
import random
from idlelib.rpc import response_queue

# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/jtbb/jldt_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["res"]
#     res = "|井号|序号|漏失层位|顶深(m)|底深(m)|主要岩性|漏失原因|工程简况|漏失量(m³)|累计漏失量(m³)|平均漏速(m³/h)|钻井液密度(g/cm³)|钻井液粘度(s)|备注|\n"
#     res = res + "|---" * 14 + "|\n"
#     for x in data:
#             res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }

# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/jtbb/djjx_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["res"]
#     res = f"井号为{jh}，它的其他数据为：\n"
#     res = res + "|井号测深(m)|井斜角(deg)|方位角(deg)|垂深(m)|南北分量(m)|东西分量(m)|闭合距(m)|闭合方位(deg)|全角变化率|\n"
#     res = res + "|---" * 9 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#     return {
#         "result": res,
#     }

# 气层统计
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/jtbb/fltj_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     if not response.json(): #响应（字典）为空
#         return {
#             "result": None,
#         }
#
#     data = response.json()["rs5"]
#     res = f"井号为{jh}，它的其他数据为：\n"
#     res = res + "|水平段分类气层厚度(m)Ⅰ类|水平段分类气层厚度(m)Ⅱ类|水平段分类气层厚度(m)Ⅲ类|水平段分类气层厚度(m)Ⅳ类|水平段分类气层厚度(m)干层|全井段分类气层厚度(m)Ⅰ类|全井段分类气层厚度(m)Ⅱ类|全井段分类气层厚度(m)Ⅲ类|全井段分类气层厚度(m)Ⅳ类|全井段分类气层厚度(m)干层|A靶斜深(m)|B靶斜深(m)|水平段长(m)|水平分类占比(%)Ⅰ类|水平分类占比(%)Ⅱ类|水平分类占比(%)Ⅰ+Ⅱ类|最高测试压力(Mpa)|最高测试产量(10⁴ m³/d)|无阻流量(10⁴ m³/d)|\n"
#     res = res + "|---" * 19 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#     return {
#         "result": res,
#     }

# 钻井大事纪要
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/jtbb/zjdsjy_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["rs51"]
#     res = f"{jh}井的井漏数据如下\n"
#     res = res + "|日期|井深|漏失井段|厚度|漏失层位|漏失段主要岩性|漏失量|累计漏失量|平均漏速|相对密度|粘度|漏失原因|施工状态|处理情况|备注|\n"
#     res = res + "|---" * 15 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#
#     data = response.json()["rs52"]
#     res = f"{jh}井的断钻具数据如下\n"
#     res = res + "|日期|井深|鱼顶位置|落鱼长度|钻头位置|落鱼结构|泵压变化|悬重变化|处理情况|备注|\n"
#     res = res + "|---" * 10 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#
#     data = response.json()["rs53"]
#     res = res + f"{jh}井的遇阻遇卡如下\n"
#     res = res + "|日期|井深|层位|岩性|阻卡原因|悬重变化|处理情况|备注|\n"
#     res = res + "|---" * 8 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#
#     data = response.json()["rs54"]
#     res = res + f"{jh}井的卡钻数据如下\n"
#     res = res + "|日期|井深|钻头位置|卡钻原因|处理情况|备注|\n"
#     res = res + "|---" * 6 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#
#     data = response.json()["rs55"]
#     res = res + f"{jh}井的溢流数据如下\n"
#     res = res + "|日期|井深|钻头位置|钻井液静止时间|溢出物性质|外溢速度|外溢量|钻井液液量变化|钻井液性能变化|处理情况|备注|\n"
#     res = res + "|---" * 11 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#
#     return {
#         "result": res,
#     }

# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/djfx/sctg_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["rs5"]
#     res = "|套管类别|套管名称|下井序号|外径(mm)|内径(mm)|壁厚(mm)|单根长(m)|累计长(m)|下深(m)|扣型|钢级|产地|备注|\n"
#     res = res + "|---" * 13 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#     return {
#         "result": res,
#     }

# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/jtbb/dcfc_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["fcs"][0]
#     res = "|层位|层位|斜深(m)|斜厚(m)|垂深(m)|\n"
#     res = res + "|---" * 5 + "|\n"
#     print(data)
#     for x in data:
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#     return {
#         "result": res,
#     }

# 测井解释
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/jtbb/cjjssj_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     if not response.json(): #响应（字典）为空
#         return {
#             "result": None,
#         }
#
#     data = response.json()["res"]
#     res = "|层位|井段m|厚度m|测井参数|阵列感应Ω.m|深侧向Ω.m|声波μs/m|密度g/cm3|中子%|孔隙度%|渗透率×10-3μm2|含气饱和度%|TOC%|解释结果|备注|\n"
#     res = res + "|---" * 15 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[3:]) + "|\n"
#     return {
#         "result": res,
#     }

# 二次解释
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/jtbb/zxjs_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = "|解释类别|层号|层位|井段m|厚度m|GR|AC|DEN|CNL|RT|RS|PORZ|PORY|JZK|TOC|SW|VXF|VYL|VZ	|VSY|解释结果|解释单位|备注|\n"
#     res = res + "|---" * 23 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }

# 固井质量
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/jtbb/gjjssj_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = "|顶深(m)|底深(m)|一界面解释结论|二界面解释结论|解释单位|备注|\n"
#     res = res + "|---" * 6 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[2:]) + "|\n"
#     return {
#         "result": res,
#     }

# 缝隙解释成果
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/yjpj/kyxfx/kyx_yslfjs_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["data"]
#     res = "|作业井号|测试井号|层号|深度1(m)|深度2(m)|厚度(m)|纵波时差(μs/ft)|横波时差(μs/ft)|横纵波时差比|密度(g/cm3)|泊松比|杨氏模量(×104MPa)|体积模量(×104MPa)|切变模量(×104MPa)|裂缝指数|破裂压力(梯度MPa/m)|出砂指数(×104MPa)|斯伦贝尔比(×108(MPa)2)|层位或小层|脆性指数|解释结论|备注|\n"
#     res = res + "|---" * 22 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }

# 地应力分析成果
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/yjpj/kyxfx/kyx_ysdylfx_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["data"]
#     res = "|作业井号|测试井号|深度1(m)|	深度2(m)|最大水平地应力(MPa)|最小水平地应力(MPa)|垂向应力(MPa)|水平地应力差异系数|对应小层|\n"
#     res = res + "|---" * 9 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
#
# res = main('SrWellSelector.dateselected=; SrWellSelector.glqselected=; SrWellSelector.qkdyselected=; SrWellSelector.dwmcselected=; MyPagenav.menu=dzpj/topmenu01_1.jsp; MyPagenav.menutype=topnav_menu; MyPagenav.curpage=jtbb/fltj.jsp; userName=wang_q.jhyt; MyPagenav.topmenu=dzzhpj/topmenu.jsp; JSESSIONID=057245AB7FBB406EBB59C50051DCC114; password=Qwer1001; saveCookie=true'
#      ,'焦页21-2HF')
# print(res)

# 获取cookie
import requests
import json
# def main():
#     JSESSIONID = requests.post('http://10.84.4.74/yyqer/login.jsp'
#                                , data={'name': 'wjx2023.jhyt'
#                                         , 'pwd': 'B036CC865732A82612B45BF47996F33D94B550B3EB5D4B9A'}
#                                , verify=False).cookies.get_dict()['JSESSIONID']
#     cookie = 'userName=wjx2023.jhyt; password=; JSESSIONID={}'.format(JSESSIONID)
#     return {
#         "cookie": cookie
#     }

# 多特征对比
# import requests
# def main(cookie: str, jh: str, jh1: str):
#     url = f"http://10.84.4.74/yyqer/yjpj/zhpj/zhpj_jzdb_json.jsp?jh={jh}&jh1={jh1}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"][0]
#     selfs = response.json()["selfs"]
#
#     res = "|参数|井组|对照|差值|比例|\n"
#     res = res + "|---" * 5 + "|\n"
#     i = 0
#     for x in selfs:
#         if x == None:
#             break
#         res = res + "|" + x + "|" + data[i+0] + "|" + data[i+1] + "|" + data[i+2] + "|" + data[i+3] + "|\n"
#         i += 4
#     return {
#         "result": res,
#     }

# #产能统计
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/kfzb/djda/yx_cn_json.jsp?jhs={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["data"]
#     print(data)
#     res = "|区块|井号|上报完成试气年度|标定产能时间|试气完成日期|投产日期|计算时间|最高测试产量(10⁴m³/d)|一点法平均无阻流量(10⁴m³/d)|采气指示曲线配产系数|采气指示曲线配产产量(10⁴m³/d)|测试产量配产产量(10⁴m³/d)|最高配产产量(10⁴m³/d)|测试产量单井建产能(10⁴m³/d)|测试产量累计建产能(10⁴m³/d)|采气指示曲线单井建产能(10⁴m³/d)|采气指示曲线累计建产能(10⁴m³/d)|\n"
#     res = res + "|---" * 17 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }

# 邻井与相似井对比
# import requests
# def main(cookie: str, jh: str, ljjl: str):
#     url = f"http://10.84.4.74/yyqer/yjpj/kyxfx/kyxdb_json.jsp?jh={jh}&ljjl={ljjl}&fxlx=null"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res3"]
#
#     res = "|井号|水平段长|垂深范围|平均垂深|粘土矿物范围|平均黏土矿物|地层密度方位|平均底层密度|含气饱和度范围|平均含气饱和度|类型|距离|无阻流量|\n"
#     res = res + "|---" * 13 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }

# 脆性矿物含量统计
import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/yjpj/kyxfx/kyx_cxkwhl_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["data"]
#
#     res = "测试日期|层位|顶深|底深|距顶|岩性|黏土质量|硬石膏含量(%)|方沸石含量(%)|石英含量(%)|钾长石含量(%)|	斜长石含量(%)|方解石含量(%)|铁白云石含量(%)|白云石含量(%)|菱铁矿含量(%)|无水芒硝含量(%)|黄铁矿含量(%)|石盐含量(%)|钙芒硝含量(%)|石膏含量(%)|重晶石含量(%)|浊沸石含量(%)|\n"
#     res = res + "|---" * 23 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[2:]) + "|\n"
#     return {
#         "result": res,
#     }

#黏土矿物数据
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/yjpj/kyxfx/kyx_ntkwhl_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["data"]
#
#     res = "|测试日期|层位|顶深	|底深|距顶|岩性|黏土总量|伊/蒙间层相对含量(%)|伊/蒙间层绝对含量(%)|伊利石(I)相对含量(%)|伊利石(I)绝对含量(%)|高岭石(K)相对含量(%)|高岭石(K)绝对含量(%)|绿泥石(C)相对含量(%)|绿泥石(C)绝对含量(%)|间层比(%S)I/S|\n"
#     res = res + "|---" * 16 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[2:]) + "|\n"
#     return {
#         "result": res,
#     }

#聚类分析
# import requests
# def main(cookie: str, jhjlxf: str, fl: str):
#     url = f"http://10.84.4.74/yyqer/yjpj/zhpj/zhpj_jlfx_json.jsp?selstr=1000,3001,3005,4007&flag=1&jhjlxf={jhjlxf}&fl={fl}&fxlx=kyx&showxh0=0&showxh1=1"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = "|井号|垂深|粘土矿物|含气饱和度|破裂压力|聚类结果|顶界深度|底界深度|\n"
#     res = res + "|---" * 8 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }

# 人机交互评价
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/yjpj/kyxfx/kyxjhpj_json.jsp?"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["resd1"]
#     res = "|井号|垂深|脆性矿物|粘土矿物|地层密度|推荐评价|人工评价|机器评价|\n"
#     res = res + "|---" * 8 + "|\n"
#     for x in data:
#         res = res + "|" + x[0] +"|" + "|".join(x[2:]) + "|\n"
#     return {
#         "result": res,
#     }

# 机器评价结果数据
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/yjpj/kyxfx/kyx_jqpj_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["resd1"]
#     res = "|垂深|脆性矿物|粘土矿物|地层密度|含气饱和度|机器评价|\n"
#     res = res + "|---" * 6 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[2:]) + "|\n"
#     return {
#         "result": res,
#     }

# G函数裂缝面积
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/sqgc/gfunc/lfmj_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = "|段号|单段液量V(M³)|杨氏模量E(GPa)|泊松比v|体积模量E‘|簇数/|瞬时停泵压力ISIP(MPa)|闭合压力(G函数)pc(psi)|闭合压力(G函数)pc(MPa)|闭合特征dp/dG(G函数)p*(psi)|闭合特征dp/dG(G函数)p*(MPa)|缝高hf(m)|泵注时间tp(min)|主裂缝半长L(m)|主裂缝面积Afm(m²)|天然裂缝面积A_fm(m²)|总裂缝面积A_fm(m²)|复杂度Nf/Hf|闭合次数/|G函数分型/|\n"
#     res = res + "|---" * 20 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#     return {
#         "result": res,
#     }

# 查询压裂液摩阻
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/sqgc/gfunc/mzjscx_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = "|射孔中深(m)|管柱内径(mm)|停前排量(m³/min)|停前压力(MPa)|ISIP(MPa)|千米摩阻(MPa/km)|减阻率%|\n"
#     res = res + "|---" * 7 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[2:]) + "|\n"
#     return {
#         "result": res,
#     }

# 设计符合率
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/sqgc/sgfhl_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["data"]
#     res = "|段号|设计加砂量(m³)|实际加砂量(m³)|加砂量完成率(%)|设计液量(m³)|实际液量(m³)|液量完成率(%)|设计粘度(mpa.s)|实际粘度(mpa.s)|粘度偏差(mpa.s)|设计排量(m³/min)|实际平均排量(m³/min)|排量实际占比(%)|裂缝半长目标值(m)|裂缝半长计算值(m)|裂缝半长比目标值(%)|\n"
#     res = res + "|---" * 16 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#     return {
#         "result": res,
#     }

# 查询施工质量评分结果
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/sqgc/yhfx/sgzlpfjg_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = "|压裂段序号|停泵次数|砂堵次数|主裂缝半长m|G函数闭合次数|G函数分型|曲线形态|净压力超两向应力差时长占比|暂堵前后两级压差|砂量符合率|液量符合率|粘度符合率|平均施工排量符合率|参数评价|曲线评价|压力评价|裂缝评价|设计主裂缝半长m|主裂缝半长符合率|总评分|\n"
#     res = res + "|---" * 20 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#     return {
#         "result": res,
#     }

# 气藏分析 总览
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/kfdtgl/qcfx/kfzbb_json.jsp?"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = "|区块|总井数|开井数|平均套压|平均油压|月平均日产量井口气(万方)|月平均日产量工业气(万方)|月平均日产量油(吨)|月平均日产量水(方)|平均单井日产气(万方)|月产量井口气(万方)|月产量工业气(万方)|月产量油(吨)|月产量水(方)|年产量井口气(万方)|年产量工业气(万方)|年产量油(吨)|年产量水(方)	|累产量井口气(万方)|累产量工业气(万方)|累产量油(吨)|累产量水(万方)|水气比|气油比|探明地质储量|动用地质储量(10⁸ m³)|可采储量(10⁸ m³)|剩余可采储量(10⁸ m³)|采气速度(%)|采出程度(%)|综合递减率(%)|储采比|\n"
#     res = res + "|---" * 32 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }

# 气藏分析开发现状
# import requests
# def main(cookie: str, rq: str):
#     url = f"http://10.84.4.74/yyqer/qcgc/kfxz/kfxz_scyl_json.jsp?rq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()
#     res = "|井号|生产压力|外输压力|产气量|产水量|水气比|\n"
#     res = res + "|---" * 6 + "|\n"
#
#     i = 0
#     for x in data:
#         if i == 100:
#             break
#         res = res + "|" + x["jh"] + "|" + x["scyl"] + "|" + x["sqyl"] + "|" + x["rcql"] + "|" + x["rcsl"] + "|" + x["sqb"] + "|\n"
#         i += 1
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=3B6CAA5DA7B5BC2849591DF17148F189"
#            ,"2025-04-01")
# print(res)

# 生产指标
# import requests
# def main(cookie: str, jh: str, srq: str, erq: str, ):
#     url = f"http://10.84.4.74/yyqer/qcgc/cnzb/sczb_qx_json.jsp?jh={jh}&srq={srq}&erq={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = "|日期|总井数|开井数|老井日产气|新井日产气|老井日产水|新井日产水|套压|油压|输压|新井套压|新井油压|老井套压|老井油压|\n"
#     res = res + "|---" * 14 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[0:7]) +"|" + "|".join(x[9:]) + "|\n"
#     return {
#         "result": res,
#     }

# 区块产能指标
# import requests
# def main(cookie: str, fqtype: str):
#     url = f"http://10.84.4.74/yyqer/qcgc/kfzb/qkkfzb_json.jsp?fqtype={fqtype}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["rs"]
#     res = "|区块|动用储量(10⁸m³)|技术可采储量(10⁸m³)|剩余技术可采储量(10⁸m³)|动用储量采出程度(%)|技术可采储量采出程度(%)|动用储量采气速度(%)|技术可采储量采气速度(%)|剩余可采储量采气速度(%)|区块产能(10⁸m³)|产能负荷因子|总水气比(m³/10⁴m³)|储采比|单位压降产量(10⁴m³/MPa)|自然递减率(%)|套压同比压降值(MPa)|油压同比压降值(MPa)|\n"
#     res = res + "|---" * 17 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=07C31BA5D9E31A8E7A6520C60D76EF37"
#             ,"qkdymc")
# print(res)

# 单井产能、储量基础信息
# import requests
# def main(cookie: str,jh :str):
#     url = f"http://10.84.4.74/yyqer/kfdtgl/djfx/djclcl_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["rs"]
#     res = "|单井产能方案设计值(万方/天)|新建产能方案设计值(万方/天)|单井技术可采储量方案设计值(万方/天)|单井动用面积|实际单井动用储量|单井动用地质储量(亿方)|新建产能核定标定年份|新建产能核定单井产能(万方/天)|新建产能核定保有产能(万方/天)|新建产能核定新建产能(万方/天)|2023年底标定值单井技术可采储量(亿方)|2023年底标定值单井经济可采储量(亿方)|\n"
#     res = res + "|---" * 12 + "|\n"
#     for x in data:
#         if x[5] == jh:
#             res = res + "|" + "|".join(x[6:18]) + "|\n"
#             break
#     return {
#         "result": res,
#     }
# res = main("userName=jx2023.jhyt; password=; JSESSIONID=3B6CAA5DA7B5BC2849591DF17148F189","焦页1-2HF")
# print(res)

# 单井产能指标
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/qcgc/kfzb/djkfzb_json.jsp?"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["rs"]
#     res = "|动用储量(10⁸m³)|技术可采储量(10⁸m³)|剩余技术可采储量(10⁸m³)|动用储量采出程度(%)|技术可采储量采出程度(%)|动用储量采气速度(%)|技术可采储量采气速度(%)|剩余可采储量采气速度(%)|区块产能(10⁸m³)|产能负荷因子|总水气比(m³/10⁴m³)|储采比|单位压降产量(10⁴m³/MPa)|自然递减率(%)|套压同比压降值(MPa)|油压同比压降值(MPa)|\n"
#     res = res + "|---" * 17 + "|\n"
#     for x in data:
#         if jh == x[0]:
#             res = res + "|" + "|".join(x[1:]) + "|\n"
#             break
#     return {
#         "result": res,
#     }
# res = main(""
#             ,"焦页2-5HF")
# print(res)

# 产销情况
# import requests
# def main(cookie: str,qk: str,nd1: str,nd2: str):
#     url = f"http://10.84.4.74/yyqer/qcgc/cnzb/cxqk_json.jsp?qk={qk}&nd1={nd1}&nd2={nd2}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"{qk}当前产销如下"
#     res = res + "|日期|天数|产量(万方)|销量(万方)|日产量(万方)|日销量(万方)|同比产量(万方)|同比销量(万方)|产油量(吨)|销售油量(吨)|日产油(吨)|日销油(吨)|同比产油量(吨)|同比销油量(吨)|\n"
#     res = res + "|---" * 14 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#
#     return {
#         "result": res,
#     }
# res = main("userName=jx2023.jhyt; password=; JSESSIONID=3B6CAA5DA7B5BC2849591DF17148F189"
#      ,"","","")
# print(res)

# 计划对比
# import requests
# def main(cookie: str,qk: str,nd: str):
#     url = f"http://10.84.4.74/yyqer/qcgc/cnzb/jhwcqk_json.jsp?qk={qk}&nd={nd}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     gzmb = response.json()["gzmb"]
#     res = f"{qk}的工作目标如下\n"
#     res = res + "|月份|日销气量|日产量|月产量|\n"
#     res = res + "|---" * 4 + "|\n"
#     i = 1
#     for i in range(1,13):
#         res = res + "|" + f"{i}月" + "|" + gzmb[0][i] + "|" + gzmb[1][i] +"|" + gzmb[2][i] + "|\n"
#
#     fdmb = response.json()["fdmb"]
#     res = res + f"{qk}的奋斗目标如下\n"
#     res = res + "|月份|日销气量|日产量|月产量|\n"
#     res = res + "|---" * 4 + "|\n"
#     i = 1
#     for i in range(1, 13):
#         res = res + "|" + f"{i}月" + "|" + fdmb[0][i] + "|" + fdmb[1][i] + "|" + fdmb[2][i] + "|\n"
#
#     scsj = response.json()["scsj"]
#     res = res + f"{qk}的实际生产如下\n"
#     res = res + "|月份|日销气量|月销气量|日产气量|月产气量|\n"
#     res = res + "|---" * 5 + "|\n"
#     i = 1
#     for x in scsj:
#         res = res + "|" + "|".join(x[2:]) + "|\n"
#
#     return {
#         "result": res,
#     }
# res = main("userName=jx2023.jhyt; password=; JSESSIONID=3B6CAA5DA7B5BC2849591DF17148F189"
#      ,"涪陵气田","2024")
# print(res)

#日度对比
# import requests
# def main(cookie: str,jhs: str,rq: str):
#     url = f"http://10.84.4.74/yyqer/scbb/r_rddb_json.jsp?jhs={jhs}&rq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = "|公司|层位|区块|管理区|井号|生产井段m|开采方式|生产时间h|套压MPa|油压MPa|昨日气产量m³|今日气产量m³|△气产量m³|%|水m³|备注|\n"
#     res = res + "|---" * 16 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[0:5]) +"|" + "|".join(x[6:]) + "|\n"
#
#     return {
#         "result": res,
#     }
# res = main("userName=jx2023.jhyt; password=; JSESSIONID=3B6CAA5DA7B5BC2849591DF17148F189"
#      ,"焦页1-4HF","2025-04-09")
# print(res)

# 压力分析
# import requests
# def main(cookie: str,jh: str):
#     url = f"http://10.84.4.74/yyqer/scbb/cqscdt/cqscdt_yltj_json.jsp?"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = "|压力≥10MPa时日产10⁴m³/d|压力≥10MPa时累产10⁴m³|压力<10MPa时日产10⁴m³/d|压力<10MPa时累产10⁴m³|压力≥7MPa时日产10⁴m³/d|压力≥7MPa时累产10⁴m³|压力<7MPa时日产10⁴m³/d|压力<7MPa时累产10⁴m³|10MPa-9MPa时日产10⁴m³/d|10MPa-9MPa时累产10⁴m³|9MPa-8MPa时日产10⁴m³/d|9MPa-8MPa时累产10⁴m³|8MPa-7MPa时日产10⁴m³/d|8MPa-7MPa时累产10⁴m³|7MPa-6MPa时日产10⁴m³/d|7MPa-6MPa时累产10⁴m³|6MPa-5MPa时日产10⁴m³/d|6MPa-5MPa时累产10⁴m³|5MPa-目前时日产10⁴m³/d|5MPa-目前时累产10⁴m³|\n"
#     res = res + "|---" * 20 + "|\n"
#     for x in data:
#         if x[0] == jh:
#             res = res + "|" + "|".join(x[1:]) + "|\n"
#             break
#     return {
#         "result": res,
#     }
# res = main("userName=jx2023.jhyt; password=; JSESSIONID=3B6CAA5DA7B5BC2849591DF17148F189"
#      ,"焦页1HF")
# print(res)

# 油藏分析总览
# import requests
# def main(cookie: str,rq: str):
#     url = f"http://10.84.4.74/yyqer/kfdtgl/qcfx/y_ycfx_json.jsp?rq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["res"]
#     res = "|井号|生产层位|储集岩类|生产时间|油嘴|生产压力（MPa）|套压（MPa）| 油压（MPa）|输压（MPa）|井口气日产量（m³）|水日产量（m³）| 油日产量（t）|油日产量（m³）|气油比（方/方）|含水率（%）|井口气累产量（10⁴ m³）|工业气累产量（10⁴ m³）|水累产量（m³）|油累产量（t）|油类产量（m³）|备注|\n"
#     res = res + "|---" * 21 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=jx2023.jhyt; password=; JSESSIONID=3B6CAA5DA7B5BC2849591DF17148F189"
#      ,"2025-04-10")
# print(res)

#单井统计
# import requests
# def main(cookie: str,jh: str,srq: str,erq: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/sjtj/sjtj_dj_json.jsp?srq={srq}&erq={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = "|流压(次)|静压(次)|产能试井(次)|压力恢复(次)|产剖测试(次)|气分析(次)|水分析(次)|油分析(次)|测液面(次)|合计|\n"
#     res = res + "|---" * 10 + "|\n"
#     for x in data:
#         if x[0] == jh:
#             res = res + "|" + "|".join(x[1:]) + "|\n"
#             break
#
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=4DF91946B0DBA03D0E4A447F86E0CEFF"
#      ,"焦页1-2HF","2021-04-08","2025-04-10")
# print(res)

# 运行表
# import requests
# def main(cookie: str,nd: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/sjtj/sjtj_yxball_json.jsp?nd={nd}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = "|年月|流压|静压|产能试井|压力恢复|产剖测试|气分析|水分析|气质分析|合计|\n"
#     res = res + "|---" * 10 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=D819FE48C8989DCE448C73B0DBA671BA"
#      ,"2025")
# print(res)

# 测压计划表
# import requests
# def main(cookie: str,lx: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/sjtj/sjtj_ylcsjhb_json.jsp?lx={lx}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = "|井号|投产日期|描述|频率|最近测试日期|4月|5月|6月|7月|8月|9月|10月|11月|12月|\n"
#     res = res + "|---" * 13 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=D819FE48C8989DCE448C73B0DBA671BA"
#      ,"测流压")
# print(res)

# 单井测压
# import requests
# def main(cookie: str,jh: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/yljc/yl_dj_sj.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["res"]
#     res = "|层位|测试目的|测压日期|套压MPa|油压MPa|气产量10⁴m³/d|井口温度℃|仪器型号及编号|仪器量程MPa|仪器精度%|井深m|垂深m|压力MPa|压力梯度MPa/100m|温度℃|温度梯度℃/100m|气层中部深度m|液面深度m|气层中部压力MPa|压力系数|备注|\n"
#     res = res + "|---" * 21 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=D819FE48C8989DCE448C73B0DBA671BA"
#      ,"兴页L1002HF")
# print(res)

# 测液面
# import requests
# def main(cookie: str,jh: str,srq: str,erq: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/cym_json.jsp?jh={jh}&srq={srq}&erq={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"{jh}在{srq}到{erq}的测液面数据如下："
#     res = res + "|油管内径mm|油管外径mm|完井管柱下入深度m|完井管柱底部位置(井斜角)|测试日期|仪器型号|套压MPa|油压MPa|产气量104m3|气层中部深度m|液面深度m|液面垂深m|压力计下入井深m|测压液面深度m|推算静压MPa|备注|测试单位|\n"
#     res = res + "|---" * 17 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=D819FE48C8989DCE448C73B0DBA671BA"
#      ,"涪陆101HF","2017-01-01","2025-04-11")
# print(res)

# 溶液离子
# import requests
# def main(cookie: str,srq: str,erq: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/rylzfx_json.jsp?srq={srq}&erq={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"{srq}到{erq}的溶液离子数据如下："
#     res = res + "|井号|管理区|层位|井段顶深|井段底深|样品编号|样品描述|分析人|审核人|取样日期|分析日期|分析类型|PH值|水相对密度(g/ml)|Li⁺|K⁺|Na⁺|KNa⁺|NH₄⁺|Ca²⁺|Mg²⁺|Ba²⁺|Sr²⁺|阳离子总值|F⁻|Cl⁻|Br⁻|I⁻|NO₃⁻|SO₄²⁻|HCO₃⁻|CO₃²⁻|OH⁻|	阴离子总量|总矿化度(mg/l)|水型|备注|投产日期|累产天数|累产气量10⁴m³|累产水量m³|取样单位|取样人|取样部位|\n"
#     res = res + "|---" * 44 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=D819FE48C8989DCE448C73B0DBA671BA"
#      ,"2025-03-12","2025-04-11")
# print(res)

#气质分析
# import requests
# from datetime import datetime
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/cpqfx_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     nowDate = datetime.now() # 获取当前日期
#     res = f"气质分析如下数据如下："
#     res = res + "|名称|样品编号|取样日期|取样单位|取样位置|取样人|分析人|审批人|分析日期|高位发热量MJ/m³|硫化氢mg/m³|总硫mg/m³|历年最低环境温度℃|管输压力Mpa|露点℃|二氧化碳%|检测结论|检测单位|备注|\n"
#     res = res + "|---" * 19 + "|\n"
#     for x in data:
#         date = datetime.strptime(x[2],"%Y-%m-%d") #获取本行数据的取样日期
#         diff = nowDate - date # 获取差值
#         if diff.days < 150:
#             res = res + "|" + "|".join(x) + "|\n" #获取半年内的数据
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=D819FE48C8989DCE448C73B0DBA671BA")
# print(res)

# 同位素
# import requests
# def main(cookie: str,jh: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/twshz/tws_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"{jh}的同位素数据如下："
#     res = res + "|生产井段(m)|层位|取样日期|取样部位|取样压力|气体组分摩尔(%)CH₄|气体组分摩尔(%)C₂H₆|气体组分摩尔(%)C₃H₈|气体组分摩尔(%)CO₂|气体组分摩尔(%)N₂|ΣnC1+~nC5|气体组分摩尔(%)-干燥系数|δC13‰-CO₂|δC13‰-CH₄|δC13‰-C₂H₆|δC13‰-C₃H₈|δC13‰-iC₄|δC13‰-nC₄|投产日期|\n"
#     res = res + "|---" * 19 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[1:6]) +"|" +"|".join(x[8:22]) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=D819FE48C8989DCE448C73B0DBA671BA"
#            ,"焦页7-2HF")
# print(res)

#细菌
# import requests
# from datetime import datetime
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/xjfx_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     nowDate = datetime.now() # 获取当前日期
#     res = f"细菌数据如下："
#     res = res + "|井号|层位|井段顶深|井段底深|样品编号|颜色|嗅|沉淀情况|透明度|取样单位|取样人|取样位置|取样日期|分析日期|分析人|审核人|腐生菌|硫酸盐还原菌|铁细菌|备注|\n"
#     res = res + "|---" * 19 + "|\n"
#     for x in data:
#         date = datetime.strptime(x[12],"%Y-%m-%d") #获取本行数据的取样日期
#         diff = nowDate - date # 获取差值
#         if diff.days < 30:
#             res = res + "|" + "|".join(x) + "|\n" #获取30天内的数据
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=48F4FED6F30E613400D96CD692426824")
# print(res)

# 溶液水
# import requests
# from datetime import datetime
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/rysfx_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     nowDate = datetime.now() # 获取当前日期
#     res = f"溶液水数据如下："
#     res = res + "|井号|样品编号|取样单位|取样人|取样位置|分析人|审核人|取样日期|分析日期|水质量分数浓度%|备注|\n"
#     res = res + "|---" * 11 + "|\n"
#     for x in data:
#         date = datetime.strptime(x[10],"%Y-%m-%d") #获取本行数据的取样日期
#         diff = nowDate - date # 获取差值
#         if diff.days < 365:
#             res = res + "|" + x[0] + "|" + "|".join(x[4:]) + "|\n" #获取1年内的数据
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=48F4FED6F30E613400D96CD692426824")
# print(res)

# 产剖测试
# import requests
# from datetime import datetime
# def main(cookie: str,jh: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/fdqs/fdqs_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"{jh}的产剖测试数据如下："
#     res = res + "|段|斜深1|斜深2|垂深1|垂深2|各级产水量(方/天)|各簇产水量(方/天)|各簇产水量占百分比(%)|各级产水量占百分比(%)|各级产气量(方/天)|各簇产气量(方/天)|各簇产气量占百分比(%)|各级产气量占百分比(%)|簇内平均温度|簇内平均压力|\n"
#     res = res + "|---" * 15 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=48F4FED6F30E613400D96CD692426824"
#            ,"焦页1HF")
# print(res)

# 压力恢复测试
# import requests
# from datetime import datetime
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/ylhh/ylhf_jcsj_json.jsp?"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"的压力恢复测试数据如下："
#     res = res + "|井号|测试时间|测试单位|层位|气层中部垂度|仪器型号及编号|仪器压力计量程Mpa|仪器温度计量程℃|仪器压力计精度Mpa|仪器温度计精度℃|仪器压力计数量|下入深度|关井前气产量10⁴m³/d|关井前水产量m³/d|关井时刻油压Mpa|关井时刻套压Mpa|关井时刻井底流压Mpa|关井时刻最高恢复压力Mpa|开井阶段累计产气量10⁴m³/d|开井阶段生产时间h|关井时间h|备注|\n"
#     res = res + "|---" * 22 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=48F4FED6F30E613400D96CD692426824")
# print(res)

# 微注入测试
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/wzrcs_jcsj_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"微注入测试数据如下："
#     res = res + "|井号|测试时间|测试单位|层位|射孔井段深度m|测试层位|压力计位置m|仪器型号及编号|压力计精度%|压力计量程MPa|压力计数量|注入排量L/min|注入量m³|施工压力MPa|停泵压力MPa|最终关井井口压力MPa|总关井时间h|备注|\n"
#     res = res + "|---" * 18 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=48F4FED6F30E613400D96CD692426824")
# print(res)

# 压力汇总
# import requests
# def main(cookie: str,jh: str,srq: str,erq: str,cylx: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/yljc/yl_hz_json.jsp?jh={jh}&srq={srq}&erq={erq}&cylx={cylx}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"{srq}到{erq}时间段,测压项目为{cylx},{jh}的压力汇总数据如下："
#     res = res + "|层位|测试目的|测压日期|套压MPa|油压MPa|气产量10⁴m³/d|测压日产水量m³/d|测压日累产气量10⁴m³|测压日累产水量m3|井口温度℃|气层中部深度m|液面深度m|气层中部压力MPa|气层中部温度℃|气层中部压力/井口套压|最大压力梯度MPa/100m|压力系数|区块|测试单位|备注|\n"
#     res = res + "|---" * 20 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=48F4FED6F30E613400D96CD692426824"
#            ,"焦页1-S10HF","2025-01-02","2025-04-12","测流压")
# print(res)

#气分析
# import requests
# def main(cookie: str,srq: str,erq: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/qfx/qfx_json.jsp?srq={srq}&erq={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"{srq}到{erq}时间段,气分析数据如下："
#     res = res + "|管理区|井号|层位|井段顶深|井段底深|样品编号|样品描述|取样单位|取样人|取样部位|分析人|审核人|取样日期|化验日期|相对密度|临界温度K|临界压力Mpa|摩尔质量|压缩因子|硫化氢mg/m³|二氧化碳g/m³|氦气|氢气|氮气|二氧化碳|硫化氢|甲烷|乙烷|丙烷|异丁烷|正丁烷|异戊烷|正戊烷|己烷|备注|投产日期|累产天数|累产气量10⁴m³|累产水量m³|\n"
#     res = res + "|---" * 39 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=48F4FED6F30E613400D96CD692426824"
#           ,"2025-04-03","2025-04-12")
# print(res)

# 油分析
# import requests
# def main(cookie: str,jh: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/yfx_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["res"]
#     res = f"{jh}的油分析数据如下："
#     res = res + "|层位|井段顶深|井段底深|样品编号|颜色|嗅|沉淀情况|透明度|取样单位|取样人|取样位置|取样日期|测试日期|水含量(%)|标准密度(kg/m³)|投产日期|累产天数|累产气量10⁴m³|累产油量t|累产水量m³|备注|\n"
#     res = res + "|---" * 21 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=48F4FED6F30E613400D96CD692426824"
#           ,"涪陆1HF")
# print(res)

# 油组分析
# import requests
# def main(cookie: str,jh: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/yzffx_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["res"]
#     res = f"{jh}的油组分析数据如下："
#     res = res + "|层位|样品类型|取样位置|取样日期|分析日期|分析单位|C1|C2|C3|C4|C5|C6|C7|C8|C9|C10|C11|C12|C13|C14|C15|C16|C17|C18|C19|C20|C21|C22|C23|C24|C25|C26|C27|C28|C29|C30|C31|C32|C33|C34|C35|C36|C37|C38|C39|C40|C41|C42|C43|Pr|Ph|甲基环已烷指数%|环已烷指数%|苯指数%|环烷指数%|庚烷值%|石蜡指数|OEP值|Pr/Ph|Pr/n-C17|Ph/n-C18|(C21+C22)/(C28+C29)|∑C21-/∑C22+|投产日期|累产天数|累产气量10⁴m³|累产油量t|累产水量m³|备注|\n"
#     res = res + "|---" * 69 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=48F4FED6F30E613400D96CD692426824"
#           ,"涪页8-1HF")
# print(res)

# 水分析
# import requests
# def main(cookie: str,srq: str,erq: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/sfxhz/sfx_json.jsp?j"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"{srq}到{erq}的水分析数据如下："
#     res = res + "|井号|管理区|层位|井段顶深|井段底深|样品编号|样品描述|取样日期|分析日期|分析人|审核人|分析类型|PH值|水相对密度(g/ml)|Li⁺|K⁺|Na⁺|KNa⁺|NH₄⁺|Ca²⁺|Mg²⁺|Ba²⁺|Sr²⁺|阳离子总值|F⁻|Cl⁻|Br⁻|I⁻|NO₃⁻|SO₄²⁻|HCO₃⁻|CO₃²⁻|OH⁻|阴离子总量|总矿化度(mg/l)|水型|备注|投产日期|累产天数|累产气量10⁴m³|累产水量m³|取样单位|取样人|取样部位|\n"
#     res = res + "|---" * 44 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=48F4FED6F30E613400D96CD692426824"
#           ,"2025-03-13","2025-04-12")
# print(res)

# 刮蜡数据
# import requests
# from datetime import datetime
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/glsj_list.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     nowDate = datetime.now() # 获取当前日期
#     res = f"刮蜡数据如下："
#     res = res + "|井号|刮蜡日期|套压(MPa)|油压(MPa)|刮蜡深度(m)|刮蜡量(Kg)|刮蜡时长(min)|备注|\n"
#     res = res + "|---" * 8 + "|\n"
#     for x in data:
#         date = datetime.strptime(x["RQ"],"%Y-%m-%d") #获取本行数据的取样日期
#         diff = nowDate - date # 获取差值
#         if diff.days < 30:
#             res = res + "|" + x["JH"] + "|" + x["RQ"] + "|" + x["TY"] + "|" + x["YY"] + "|" + x["GLSD"] + "|" + x["GLL"] + "|" + x["GLSC"] + "|" + x["BZ"] + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=48F4FED6F30E613400D96CD692426824")
# print(res)


# 微地震监测
# import requests
# def main(cookie: str,jh: str,jcfs: str):
#     url = f"http://10.84.4.74/yyqer/sqgc/zhfx/wdzjc_json.jsp?jh={jh}&jcfs={jcfs}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["res"]
#     res = f"检测方式为{jcfs},{jh}的微地震监测数据如下："
#     res = res + "|压裂段|穿行层位|微地震事件数目|西翼裂缝网络长(米)|东翼裂缝网络长(米)|总长度(m)|西翼裂缝网络宽(米)|东翼裂缝网络宽(米)|平均宽度(m)|长宽比|高度(m)|裂缝网络走向|储层改造体积(10⁴m³)|监测距离|\n"
#     res = res + "|---" * 14 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[:-1]) + "|\n"
#     res = res + "|" + "|".join(response.json()["resHJ"][0]) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=48F4FED6F30E613400D96CD692426824"
#           ,"焦页2-5HF","地面监测")
# print(res)

# 气田产量
# import requests
# def main(cookie: str,srq: str,erq: str):
#     url = f"http://10.84.4.74/yyqer/kfdtgl/sjtj_json.jsp?srq={srq}&erq={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["res"]
#     res = f"{srq}到{erq}的气田产量如下："
#     res = res + "|日期|一区流量(万方)|二区流量(万方)|三区流量(万方)|四区流量(万方)|合计(万方)|\n"
#     res = res + "|---" * 6 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=48F4FED6F30E613400D96CD692426824"
#           ,"2025-04-10","2025-04-12")
# print(res)

# 集气站产量
# import requests
# def main(cookie: str,glq: str):
#     url = f"http://10.84.4.74/yyqer/kfdtgl/fstj_json.jsp?glq={glq}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["rs"]
#     res = f"{glq}的集气站产量如下："
#     res = res + "|集气站|8:00|9:00|10:00|11:00|12:00|13:00|14:00|15:00|16:00|17:00|18:00|19:00|20:00|21:00|22:00|23:00|0:00|1:00|2:00|3:00|4:00|5:00|6:00|7:00|8:00|9:00|10:00|11:00|12:00|13:00|14:00|15:00|16:00|17:00|\n"
#     res = res + "|---" * 35 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=48F4FED6F30E613400D96CD692426824"
#           ,"五区")
# print(res)

# 气田销量
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/kfdtgl/clgl/qtxl_json.jsp?"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["res"]
#     res = f"气田销量数据如下："
#     res = res + "|日期|乌江北销量|乌江南销量|白马销量|平桥销量|合计(万方)|\n"
#     res = res + "|---" * 6 + "|\n"
#     for x in data:
#         if x[0] == None:
#             break
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=48F4FED6F30E613400D96CD692426824")
# print(res)

# 单井实时预警
# import requests
# def main(cookie: str,jh: str):
#     url = f"http://10.84.4.74/yyqer/sssj/djssyj_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"{jh}的实时预警如下："
#     res = res + "|最小压力Mpa|最大压力Mpa|压力波动幅度|最小输压Mpa|最大输压|输压波动幅度|\n"
#     res = res + "|---" * 6 + "|\n"
#     for x in data:
#         if jh in x[1]:
#             res = res + "|" + "|".join(x[2:]) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=48F4FED6F30E613400D96CD692426824"
#            ,"焦页91-1HF")
# print(res)

# 井筒积液预警
# import requests
# def main(cookie: str,rq: str):
#     url = f"http://10.84.4.74/yyqer/jtjy/yjfx_hlyc_json.jsp?rq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["res"]
#     res = f"{rq}的井筒积液预警如下："
#     res = res + "|井号|水气比|产气量|油压|压差|合理压差|油管内径|结果|\n"
#     res = res + "|---" * 8 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=48F4FED6F30E613400D96CD692426824"
#            ,"2025-04-11")
# print(res)

# 临界携液流量
# import requests
# def main(cookie: str,jh: str):
#     url = f"http://10.84.4.74/yyqer/dtyczd/cqgcfx/ljxyll_json.jsp?jh={jh}&H=2412.5&currcl=1.0944&curryl=0.1&t0=25.0&wj=73.0&bh=5.51&tpc=191.02&ppc=4.6&rg=0.5637&tk=308.15&hk=&tg=139.7,10.54&yg=88.9,6.54&sqb=0.5"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["v"]
#     zdv = response.json()["zdv"]
#
#     res = f"{jh}的临界携液流量如下："
#     res = res + "|李闽模型临界携液流量(10⁴m³)|Turner模型临界携液流量(10⁴m³)|振荡模型临界携液流量(10⁴m³)|连续排液产量(10⁴m³)|管柱冲蚀流量(10⁴m³)|\n"
#     res = res + "|---" * 5 + "|\n"
#     i = 0
#     for x in data:
#         res = res + "|" + str(x[0]) + "|" + str(x[3]) + "|" + str(zdv[i]) + "|" + str(x[1]) + "|" + str(x[2]) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=F36F8A2650655F2C02442F652896EDAB"
#            ,"焦页1HF")
# print(res)

# 低压预警
# import requests
# def main(cookie: str,rq: str):
#     url = f"http://10.84.4.74/yyqer/dtyczd/scycyj/fjxjlgj_json.jsp?rq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["data"]
#
#     res = f"{rq}的临低压预警如下："
#     res = res + "|井号|日产气量|日产水量|油压|套压|油套压差|前日油套压差|生产压力|输压|生产压力输压差|累水气比|水气比|累产气|携液流量|预警|\n"
#     res = res + "|---" * 16 + "|\n"
#     i = 0
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=F36F8A2650655F2C02442F652896EDAB"
#            ,"2021-12-21")
# print(res)

# # 间开井提示
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/kfdtgl/jkj/jkj_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["gjjhs1"]
#     res = f"间开井开井提示如下："
#     res = res + "|井号|本次关井原因|本次关井时间|气井分类|套压|油压|油套压差|日产气(近一个月)|日产水(近一个月)|水气比(近一个月)|上一间开制度|上上间开制度|日产气|日产水|油套压差|开井方式|是否需要调整|\n"
#     res = res + "|---" * 17 + "|\n"
#     i = 0
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#
#     data = response.json()["kjjhs1"]
#     res = res + f"间开井关井提示如下："
#     res = res + "|井号|日产气(小时)|日度产量波动%|小时产量波动%|气井分类|套压|油压|油套压差|日产气(近一个月)|日产水(近一个月)|水气比(近一个月)|上一间开制度|上上间开制度|日产气|日产水|油套压差|对策|是否需要调整|\n"
#     res = res + "|---" * 18 + "|\n"
#     i = 0
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=F36F8A2650655F2C02442F652896EDAB"
#            )
# print(res)

# 产量异常提示
# import requests
# def main(cookie: str,rq: str):
#     url = f"http://10.84.4.74/yyqer/kfdtgl/jkj/clyctsdj_json.jsp?rq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res33"]
#     res = f"{rq}的产量异常提示如下："
#     res = res + "|井号|生产时间h|套压MPa|油压MPa|输压MPa|产气量10⁴m³|水量m³|压力基数|产量基数|压力变化|产量变化|备注|\n"
#     res = res + "|---" * 12 + "|\n"
#     i = 0
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=F36F8A2650655F2C02442F652896EDAB"
#            ,"2025-04-12")
# print(res)

# 小时级积液预警
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/kfdtgl/clgl/xsjjyyj_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = f"小时级积液预警如下："
#     res = res + "|井号|管理区|8:00油压|8:00套压|8:00产气量|9:00油压|9:00套压|9:00产气量|10:00油压|10:00套压|10:00产气量|\n"
#     res = res + "|---" * 11 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=F36F8A2650655F2C02442F652896EDAB"
#            )
# print(res)

# 躺井管理
# import requests
# def main(cookie: str,glq: str,srq: str,erq: str):
#     url = f"http://10.84.4.74/yyqer/scbb/zb_tjl_json.jsp?glq={glq}&srq={srq}&erq={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = f"{glq}管理区在{srq}到{erq}的躺井管理数据如下："
#     res = res + "|井号|区块|管理区|开采方式|日均套压MPa|日均油压MPa|日均产气量m³|日均产水量m³|区间气累产量10⁴m³|区间水累产量m³|采气指标区间水气比|采气指标区间生产时率%|最大连续关井天数|状况|\n"
#     res = res + "|---" * 14 + "|\n"
#     i = 0
#     for x in data:
#         if i == 200:
#             break
#         res = res + "|" + "|".join(x) + "|\n"
#         i += 1
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=F36F8A2650655F2C02442F652896EDAB"
#            ,"一区","2025-04-06","2025-04-13")
# print(res)

# 关停井影响产量分析
# import requests
# def main(cookie: str,rq: str,dbv: str):
#     if dbv == "":
#         dbv = 5
#     url = f"http://10.84.4.74/yyqer/scbb/tjgl_json.jsp?rq={rq}&dbv={dbv}&tz="
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["data"]
#     res = f"{rq},关井天数{dbv}的关停井影响产量分析如下："
#     res = res + "|井号|最近连续关井天数|影响产量10⁴m³|备注|\n"
#     res = res + "|---" * 4 + "|\n"
#     for x in data:
#         res = res + "|" + x[4] + "|" + x[9] + "|"+ x[10] + "|"+ x[12] + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=F36F8A2650655F2C02442F652896EDAB"
#            ,"2025-04-13","7")
# print(res)

# 气井分类
# import requests
# def main(cookie: str,jh: str,rq: str):
#     url = f"http://10.84.4.74/yyqer/qcgc/clpj/r_bynl_json.jsp?tz=&jhs={jh}&rq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = f"{rq},{jh}的气井分类如下："
#     res = res + "|生产时间h|套压MPa|油压MPa|井口气日产量	m³|放空气日产量m³|水日产量	m³|投产日期|生产时率%|气井分类|气井分类2|备注|\n"
#     res = res + "|---" * 11 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[2:13]) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=97CEAF27FA3F4AABA6D3CB9AFB309DA8"
#            ,"焦页1HF","2025-04-12")
# print(res)

# 生产时率
# import requests
# def main(cookie: str,ny: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/cszb/zb_kjl_json.jsp?ny={ny}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data1 = response.json()["res"]
#     data2 = response.json()["res1"]
#
#     res = f"{ny}的生产时率如下："
#     res = res + "|区块|生产时率|\n"
#     res = res + "|---" * 2 + "|\n"
#     for x in data1:
#         res = res + "|" + x[0] + "|" + x[5] + "|\n"
#     for x in data2:
#         res = res + "|" + x[0] + "|" + x[5] + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=97CEAF27FA3F4AABA6D3CB9AFB309DA8"
#            ,"202504")
# print(res)

# 产量波动异常
# import requests
# def main(cookie: str,rq: str):
#     url = f"http://10.84.4.74/yyqer/kfdtgl/clgl/clbdyc_json.jsp?rq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#
#     res = f"{rq}的产量波动异常如下："
#     res = res + "|井号|集气站|管理区|生产压力Mpa|日产气10⁴m³|\n"
#     res = res + "|---" * 5 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=97CEAF27FA3F4AABA6D3CB9AFB309DA8"
#            ,"2025-04-10")
# print(res)

# 重点井报表
# import requests
# def main(cookie: str,rq: str):
#     url = f"http://10.84.4.74/yyqer/kfdtgl/clgl/zdjbb_json.jsp?tz=&rq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["data"]
#
#     res = f"{rq}的重点井报表如下："
#     res = res + "|类型|区块|管理区|井站|井号|生产井段m|开采方式|生产时间h|套压Mpa|油压Mpa|井口气日产量m³|放空气日产量m³|水日产量m³|油日产量t|油日产量m³|起泡剂Kg|消泡剂Kg|缓蚀杀菌剂Kg|输压Mpa|温度℃|生产自用气m³|表套Mpa|技套MPa|孔板mm|氯根mg/l|油嘴mm|投产日期|备注|\n"
#     res = res + "|---" * 28 + "|\n"
#     for x in data:
#         if x[0] == None:
#             break
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=97CEAF27FA3F4AABA6D3CB9AFB309DA8"
#            ,"2025-04-14")
# print(res)

# 异常预警
# import requests
# def main(cookie: str,rq: str):
#     url = f"http://10.84.4.74/yyqer/dtyczd/cqscdt/cq_ycfx_json.jsp?&rq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#
#     res = f"{rq}的异常预警如下："
#     res = res + "|井号|采气区|初步判断|排查方法|措施建议|生产方式|油管外径(mm)|油管壁厚(mm)|中部深度(m)|油管内径(mm)|油管下深(m)|B-A垂深差(m)|套压(MPa)|油压(Mpa)|日产气(方/天)|日产水(方/天)|实际油套压差(Mpa)|合理油套压差(MPa)|计算井底流压(MPa)|临界携液流量(方/天)|备注|\n"
#     res = res + "|---" * 21 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=97CEAF27FA3F4AABA6D3CB9AFB309DA8"
#            ,"2025-04-13")
# print(res)

# 异常井分析
# import requests
# def main(cookie: str,jh: str,srq: str,erq: str):
#     url = f"http://10.84.4.74/yyqer/cqgygl/ycyj/ycjfx_json.jsp?&jh={jh}&srq={srq}&erq={erq}&tz="
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["data"]
#
#     res = f"{srq}到{erq},{jh}的异常井分析如下："
#     res = res + "|日期|生产时间h|套压Mpa|油压Mpa|输压Mpa|温度|井口气日产量m³|放空气日产量m³|水日产量m³|油日产量t|油日产量m³|井口气月产量10⁴m³|水月产量m³|油月产量t|油月产量m³|井口气年产量10⁴m³|水年产量m³|油年产量t|油年产量m³|井口气累产量10⁴m³|工业气累产量10⁴m³|水累产量m³|油累产量t|累月产量m³|起泡剂Kg|消泡剂Kg|缓蚀杀菌剂Kg|生产自用气m³|表套|技套|流压Mpa|备注|\n"
#     res = res + "|---" * 32 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=97CEAF27FA3F4AABA6D3CB9AFB309DA8"
#            ,"焦页1-2HF"," 2025-01-14","2025-04-14")
# print(res)

# 井筒积液风险判别
# import requests
# def main(cookie: str,jh: str,rq: str):
#     url = f"http://10.84.4.74/yyqer/jtjy/jtjymhpb_json.jsp?&rq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#
#     res = f"{rq},{jh}的井筒积液风险判别如下："
#     res = res + "|30天均日产气104m3|30天均日产水m3|30天均气水比|30天日产气变化率|30天日产水变化率|30天气水比变化率|当天油套压差(MPa)|当天油压(Mpa)|30天油套压差变化率|30天油压变化率|积液风险|\n"
#     res = res + "|---" * 12 + "|\n"
#     for x in data:
#         if x[0]==jh:
#             res = res + "|" + "|".join(x[1:]) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=97CEAF27FA3F4AABA6D3CB9AFB309DA8"
#            ,"焦页1-4HF","2025-04-13")
# print(res)

# 增压识别预警
# import requests
# def main(cookie: str,jh: str,rq: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/scfx/r_zyyj_json.jsp?tz=&jhs={jh}&rq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#
#     res = f"{rq},{jh}的增压识别预警如下："
#     res = res + "|井号|生产时间h|套压MPa|油压MPa|输压MPa|井口气日产量m³|水日产量m³|投产日期|气井分类|增压识别|\n"
#     res = res + "|---" * 10 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[3:12]) + "|" + x[13] + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=97CEAF27FA3F4AABA6D3CB9AFB309DA8"
#            ,"涪茅2,涪茅3HF","2025-04-13")
# print(res)

# 日措施动态
# import requests
# def main(cookie: str,rq: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/dhc/cstj_json.jsp?srq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data1 = response.json()["res"]
#     res = f"{rq}的措施动态数据(不含复兴)如下："
#     res = res + "|措施|井数(口)|\n"
#     res = res + "|---" * 2 + "|\n"
#     for x in data1:
#         res = res + "|" + "|".join(x) + "|\n"
#
#     data2 = response.json()["res1"]
#     res = res + f"{rq}的措施动态数据(复兴)如下："
#     res = res + "|措施|井数(口)|\n"
#     res = res + "|---" * 2 + "|\n"
#     for x in data2:
#         res = res + "|" + "|".join(x) + "|\n"
#
#     data3 = response.json()["res2"]
#     res = res + f"{rq}的药剂用量动态数据如下："
#     res = res + "|药剂|井数(口)|药剂用量|\n"
#     res = res + "|---" * 3 + "|\n"
#     for x in data3:
#         res = res + "|" + "|".join(x) + "|\n"
#
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=97CEAF27FA3F4AABA6D3CB9AFB309DA8"
#            ,"2025-04-13")
# print(res)

# 泡排井跟踪
# import requests
# def main(cookie: str,rq: str):
#     url = f"http://10.84.4.74/yyqer/scbb/csyb/ppjrdhz_json.jsp?rq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["rs"]
#
#     res = f"{rq}的泡排井跟踪数据如下："
#     res = res + "|区块|管理区|井站|井号|生产时间h|套压MPa|油压MPa|井口气日产量m³|放空气日产量m³|水日产量m³|输压MPa|起泡剂Kg|消泡剂Kg|起泡剂配液浓度%|起泡剂加注时间h|起泡排量L/h|备注|\n"
#     res = res + "|---" * 17 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=97CEAF27FA3F4AABA6D3CB9AFB309DA8"
#            ,"2025-04-13")
# print(res)

# 循环气举井跟踪
# import requests
# def main(cookie: str,srq: str,erq: str):
#     url = f"http://10.84.4.74/yyqer/cqgygl/csgl/xhqj_ptzl_json.jsp?srq={srq}&erq={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#
#     res = f"{srq}到{erq}的循环气举井跟踪数据如下："
#     res = res + "|集气站|循环气举井产气量(m³/d)|循环气举井产水量(m/d)|循环气举井数|平台总气量(m³/d)|平台总水量(m³/d)|平台总井数|注入气量(m³/d)|产出：注入|气举时长(h)|助推时长(h)|助推水量(m³)|放空时长(h)|放空气量(m³)|放空水量(m³)|是否在运行|\n"
#     res = res + "|---" * 16 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=97CEAF27FA3F4AABA6D3CB9AFB309DA8"
#            ,"2025-04-07","2025-04-13")
# print(res)

# CNG气举日度跟踪
# import requests
# def main(cookie: str,srq: str,erq: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/qj/cngqj_json.jsp?srq={srq}&erq={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["resrcq"]
#
#     res = f"{srq}到{erq}的CNG气举日度跟踪数据如下："
#     res = res + "井号|气举作业单日注气量|日期|\n"
#     res = res + "|---" * 3 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=97CEAF27FA3F4AABA6D3CB9AFB309DA8"
#            ,"2023-10-02","2023-11-23")
# print(res)

# 油管完井管柱数据
# import requests
# def main(cookie: str,jh: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/jczl/wjgz_tj_ygwj4_json.jsp?ffilter=a.JH&filter={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["rs5"]
#
#     res = f"{jh}的油管完井管柱数据如下："
#     res = res + "|井号|油管内径(mm)|油管外径(mm)|油管壁厚(mm)|油管钢级|油管扣型|完井管柱结构|完井管柱下入深度(m)|完井管柱底部位置(井斜角)|开工日期|完工日期|施工周期(d)|施工单位|油管生产厂家|下管作业方式|投产日期|投产与下油管间隔天数|下管前一天套压|下管前一天日产气量(方)|备注|\n"
#     res = res + "|---" * 20 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=97CEAF27FA3F4AABA6D3CB9AFB309DA8"
#            ,"焦页1HF")
# print(res)

# 检管
# import requests
# def main(cookie: str,srq: str,erq: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/cszy/jqgx_jgzy_json.jsp?srq={srq}&erq={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     hj = response.json()["hj"]
#
#     res = f"{srq}到{erq}的检管数据如下："
#     res = res + "|井号|检管时间|压井液量(方)|检管后日均产气(方)|检管后日均产水(方)|检管后累产气(方)|检管后累产水(方)|区间产气(方)|区间产水(方)|\n"
#     res = res + "|---" * 9 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     res = res + "|" + "|".join(hj[0]) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=97CEAF27FA3F4AABA6D3CB9AFB309DA8"
#            ,"2025-03-15","2025-04-14")
# print(res)

# 气举统计
# import requests
# def main(cookie: str,jh: str,srq: str,erq: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/cszy/cq_zsqj_json.jsp?jhs={jh}&rq={erq}&rq1={srq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["list"][0]
#
#     res = f"{srq}到{erq},{jh}的气举统计如下："
#     res = res + "|井号|区块|管理区|施工开始时间|施工结束时间|气举天数|措施开始时间|措施截止时间|AB靶点垂深差|平均水气比|气举前油压|气举前套压|措施有效天数|措施前一周日均产气(万方)|措施后一周日均产气(万方)|措施前一周生产时率(%)|措施后一周生产时率(%)|措施阶段累产气(万方)|\n"
#     res = res + "|---" * 18 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=97CEAF27FA3F4AABA6D3CB9AFB309DA8"
#            ,"焦页36-1HF,焦页29-4HF","2025-01-14","2025-04-14")
# print(res)

# 泡排统计
# import requests
# from datetime import datetime
# def main(cookie: str,rq: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/cszy/cq_zs_json.jsp?rq={rq}&cslx=泡排"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["list"][0]
#     nowDate = datetime.now() # 获取当前日期
#     res = f"截止{rq}的泡排统计如下："
#     res = res + "|井号|区块|管理区|措施开始时间|措施截止时间|AB靶点垂深差|平均水气比|是否运行|停运原因|当日产气量(方)|前一日产气量(方)|产量对比(方)|月生产时率(%)|措施有效天数|措施前日均产气(万方)|措施后日均产气(万方)|措施前平均生产时率(%)|措施后平均生产时率(%)|措施前平均油套压差(MPa)|措施后平均油套压差(MPa)|措施阶段平均日产气(万方)|措施阶段累产气(万方)|措施阶段增产气量(万方)|备注|\n"
#     res = res + "|---" * 24 + "|\n"
#     count = 0
#     for x in data:
#         date = datetime.strptime(x[3],"%Y-%m-%d") # 获取数据日期
#         delta = nowDate - date # 计算日期差
#         if delta.days < 365:
#             count += 1
#             res = res + "|" + "|".join(x) + "|\n"
#     print(count)
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=97CEAF27FA3F4AABA6D3CB9AFB309DA8"
#            ,"2025-04-14")
# print(res)

# 柱塞统计
# import requests
# def main(cookie: str,rq: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/cszy/cq_zs_json.jsp?rq={rq}&cslx=柱塞"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["list"][0]
#
#     res = f"截止{rq}的柱塞统计如下："
#     res = res + "|井号|区块|管理区|措施开始时间|措施截止时间|AB靶点垂深差|平均水气比|卡定器下深m|开关井制度|油管尺寸|当日产气量(方)|前一日产气量(方)|产量对比(方)|月生产时率(%)|措施有效天数|措施前日均产气(万方)|措施后日均产气(万方)|措施前平均生产时率(%)|措施后平均生产时率(%)|措施前平均油套压差(MPa)|措施后平均油套压差(MPa)|措施阶段平均日产气(万方)|措施阶段累产气(万方)|措施阶段增产气量(万方)|备注|\n"
#     res = res + "|---" * 25 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=97CEAF27FA3F4AABA6D3CB9AFB309DA8"
#            ,"2025-04-14")
# print(res)

# 智能间开统计
# import requests
# def main(cookie: str,rq: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/cszy/cq_zs_json.jsp?rq={rq}&cslx=智能间开"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["list"][0]
#
#     res = f"截止{rq}的智能间开统计如下："
#     res = res + "|井号|区块|管理区|措施开始时间|措施截止时间|AB靶点垂深差|平均水气比|-|当日产气量(方)|前一日产气量(方)|产量对比(方)|月生产时率(%)|措施有效天数|措施前日均产气(万方)|措施后日均产气(万方)|措施前平均生产时率(%)|措施后平均生产时率(%)|措施前平均油套压差(MPa)|措施后平均油套压差(MPa)|措施阶段平均日产气(万方)|措施阶段累产气(万方)|措施阶段增产气量(万方)|备注|\n"
#     res = res + "|---" * 23 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=97CEAF27FA3F4AABA6D3CB9AFB309DA8"
#            ,"2025-04-14")
# print(res)

# 管网气气举统计
# import requests
# def main(cookie: str,rq: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/cszy/cq_zs_json.jsp?rq={rq}&cslx=管网气气举"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["list"][0]
#
#     res = f"截止{rq}的管网气气举统计如下："
#     res = res + "|井号|区块|管理区|措施开始时间|措施截止时间|AB靶点垂深差|平均水气比|-|当日产气量(方)|前一日产气量(方)|产量对比(方)|月生产时率(%)|措施有效天数|措施前日均产气(万方)|措施后日均产气(万方)|措施前平均生产时率(%)|措施后平均生产时率(%)|措施前平均油套压差(MPa)|措施后平均油套压差(MPa)|措施阶段平均日产气(万方)|措施阶段累产气(万方)|措施阶段增产气量(万方)|备注|\n"
#     res = res + "|---" * 23 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=97CEAF27FA3F4AABA6D3CB9AFB309DA8"
#            ,"2025-04-14")
# print(res)

# 电潜泵统计
# import requests
# def main(cookie: str,rq: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/cszy/cq_zs_json.jsp?rq={rq}&cslx=电潜泵"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["list"][0]
#
#     res = f"截止{rq}的电潜泵统计如下："
#     res = res + "|井号|区块|管理区|措施开始时间|措施截止时间|AB靶点垂深差|平均水气比|-|当日产气量(方)|前一日产气量(方)|产量对比(方)|月生产时率(%)|措施有效天数|措施前日均产气(万方)|措施后日均产气(万方)|措施前平均生产时率(%)|措施后平均生产时率(%)|措施前平均油套压差(MPa)|措施后平均油套压差(MPa)|措施阶段平均日产气(万方)|措施阶段累产气(万方)|措施阶段增产气量(万方)|备注|\n"
#     res = res + "|---" * 23 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=97CEAF27FA3F4AABA6D3CB9AFB309DA8"
#            ,"2025-04-14")
# print(res)

# 射流泵统计
# import requests
# def main(cookie: str,rq: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/cszy/cq_zs_json.jsp?rq={rq}&cslx=射流泵"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["list"][0]
#
#     res = f"截止{rq}的射流泵统计如下："
#     res = res + "|井号|区块|管理区|措施开始时间|措施截止时间|AB靶点垂深差|日均注水量|平均泵压|平均水气比|当日产气量(方)|前一日产气量(方)|产量对比(方)|月生产时率(%)|措施有效天数|措施前日均产气(万方)|措施后日均产气(万方)|措施前平均生产时率(%)|措施后平均生产时率(%)|措施前平均油套压差(MPa)|措施后平均油套压差(MPa)|措施阶段平均日产气(万方)|措施阶段累产气(万方)|措施阶段增产气量(万方)|备注|\n"
#     res = res + "|---" * 24 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=3D7F4CB41F595FA7907F0895EDA8A053"
#            ,"2025-04-10")
# print(res)

# 抽油机统计
# import requests
# def main(cookie: str,srq: str,erq: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/cszy/zb_zcxcs9_json.jsp?srq1={srq}&erq1={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["listA"]
#
#     res = f"{srq}到{erq}的抽油机统计如下："
#     res = res + "|措施类型|井号|开始时间|截止时间|折算措施费用(万元)|措施期(天)|累计产气(万方)|累计产水(方)|日均产气(万方)|日均产水(方)|生产小时(小时)|总耗电量|电流|冲程|冲次|措施有效率|措施回收期(天)|\n"
#     res = res + "|---" * 17 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=3D7F4CB41F595FA7907F0895EDA8A053"
#            ,"2025-03-31","2025-04-15")
# print(res)

# 循环气举统计
# import requests
# def main(cookie: str,srq: str,erq: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/cstj/xhqj_json.jsp?srq={srq}&erq={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#
#     res = f"{srq}到{erq}的循环气举统计如下："
#     res = res + "|井号|区块|管理区|措施开始时间|措施截止时间|该阶段是否循环气举|区间产气量(万方)|区间产水量(方)|区间生产时率(%)|区间平均油套压差(MPa)|\n"
#     res = res + "|---" * 10 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[2:-1]) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=3D7F4CB41F595FA7907F0895EDA8A053"
#            ,"2025-03-16","2025-04-15")
# print(res)

# 措施经济评价
# import requests
# def main(cookie: str,srq: str,erq: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/cszb/zb_cstj_json.jsp?srq1={srq}&erq1={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res33"]
#     res = f"{srq}到{erq}的措施经济评价如下："
#     res = res + "|措施类型|井口数|作业次数|区间天数(平均)|折算措施费用(万元)|累计产气(万方)|折算产气价值(万元)|有效作业次数|区块|\n"
#     res = res + "|---" * 9 + "|\n"
#     for x in data:
#         for y in x:
#             res = res + "|" + "|".join(y) + "|\n"
#
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=3D7F4CB41F595FA7907F0895EDA8A053"
#            ,"2025-03-31","2025-04-15")
# print(res)

# 药剂库存台账
# import requests
# def main(cookie: str,ny: str):
#     url = f"http://10.84.4.74/yyqer/cqgygl/csgl/yjkctz_list.jsp?whereCause1={ny}&whereCause2={ny}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["data"]
#     res = f"{ny}的药剂库存台账如下："
#     res = res + "|序号|管理区|井站|上传日期|起泡剂库存(桶)|消泡剂库存(桶)|缓蚀杀菌剂库存(桶)|起泡剂厂家|消泡剂厂家|缓蚀杀菌剂厂家|经办人|\n"
#     res = res + "|---" * 11 + "|\n"
#     for x in data:
#         res = res + "|" + x["XH"] + "|" + x["GLQ"] + "|" + x["JZ"] + "|" + x["SCRQ"] + "|" + x["QPJKC"] + "|" + x["XPJKC"] + "|" + x["HSSJJ"] + "|" + x["QPJCJ"] + "|" + x["XPJCJ"] + "|" + x["HSSJJCJ"] + "|" + x["JBR"] + "|\n"
#
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=3D7F4CB41F595FA7907F0895EDA8A053"
#            ,"202504")
# print(res)

# 集气站领料、转运台账
# import requests
# def main(cookie: str,ny: str):
#     url = f"http://10.84.4.74/yyqer/cqgygl/csgl/yjlltz_list.jsp?whereCause1={ny}&whereCause2={ny}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["data"]
#     res = f"{ny}的集气站领料、转运台账如下："
#     res = res + "|序号|管理区|井站|日期|领料/转运类型|药剂种类|厂家|生产时间|数量(桶)|经办人|备注|\n"
#     res = res + "|---" * 11 + "|\n"
#     for x in data:
#         res = res + "|" + x["XH"] + "|" + x["GLQ"] + "|" + x["JZ"] + "|" + x["RQ"] + "|" + x["LX"] + "|" + x["YJZL"] + "|" + x["CJ"] + "|" + x["SCSJ"] + "|" + x["SL"] + "|" + x["JBR"] + "|" + x["BZ"] + "|\n"
#
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=3D7F4CB41F595FA7907F0895EDA8A053"
#            ,"202504")
# print(res)

# 需求计划台账
# import requests
# def main(cookie: str,rq: str):
#     url = f"http://10.84.4.74/yyqer/scbb/csyb/xqjhtz_json.jsp?rq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["rs"]
#     res = f"{rq}的需求计划台账如下："
#     res = res + "|管理区|提报时间|需求计划名称|起泡剂计划(吨)|消泡剂计划(吨)|药剂厂家|备注|\n"
#     res = res + "|---" * 7 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=3D7F4CB41F595FA7907F0895EDA8A053"
#            ,"2023")
# print(res)

# 泡排泵撬台账
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/cqgygl/csgl/ppsbtz_json.jsp?"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = f"泡排泵撬台账如下："
#     res = res + "|ID|井号|区块|集气站|管理区|投产日期|泡排投运时间|是否有加药流程|泵撬类型|加注类型|泵功率(kw)|厂家|共用流程|是否长期停运|长期停运原因|辅助工艺|\n"
#     res = res + "|---" * 16 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[1:-1]) + "|\n"
#
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=3D7F4CB41F595FA7907F0895EDA8A053"
#            )
# print(res)

# 效果分析
# import requests
# from datetime import datetime, timedelta
# def main(cookie: str,jh: str,rq: str):
#     date = datetime.strptime(rq,"%Y-%m-%d")
#     preDate = date - timedelta(days = 1)
#     rq2 = preDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/scbb/csyb/xgfx_json.jsp?rq={rq}&rq2={rq2}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     #提取井号
#     jhs = jh.split(",")
#     dict = {}
#     for x in jhs:
#         dict[x]=1
#
#     data = response.json()["rs"]
#     res = f"{rq},{jh}的效果分析如下："
#     res = res + "|区块|管理区|井号|前一日套压Mpa|前一日油压Mpa|前一日油套压差Mpa|前一日气产量m³|前一日水产量m³|前一日水气比%|前一日生产时率%|当日套压Mpa|当日油压Mpa|当日油套压差Mpa|当日气产量m³|当日水产量m³|当日水气比%|当日生产时率%|套压变化Mpa|油压变化Mpa|油套压差变化Mpa|气产量变化m³|水产量变化m³|水气比变化%|生产时率变化%|\n"
#     res = res + "|---" * 26 + "|\n"
#     for x in data:
#         if x[2] in dict:
#             res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=3D7F4CB41F595FA7907F0895EDA8A053"
#            ,"焦页1HF,焦页1-2HF,焦页1-3HF","2025-04-15")
# print(res)

# 药剂经营分析
# from datetime import datetime, timedelta
# import requests
# def main(cookie: str,ny: str):
#     # 获取前一个月
#     date = datetime.strptime(ny+"15","%Y%m%d")
#     preDate = date - timedelta(days=31)
#     ny2 = preDate.strftime("%Y%m%d")
#     ny2 = ny2[:-2]
#
#     url = f"http://10.84.4.74/yyqer/scbb/csyb/yjjyfx_json.jsp?rq={ny}&rq2={ny2}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["rs"]
#     res = f"{ny}的药剂经营分析如下："
#     res = res + "|区块|管理区|井号|上月日均产水量(方)|理论日均起泡剂加注量(Kg)|理论日均消泡剂加注量最小值(Kg)|理论日均消泡剂加注量最大值(Kg)|理论月度起泡剂加注量(Kg)|理论月度消泡剂加注量最小值(Kg)|理论月度消泡剂加注量最大值(Kg)|实际起泡剂消耗量(Kg)|实际消泡剂消耗量(Kg)|▲起泡剂(kg)|▲消泡剂最小值(kg)|▲消泡剂最最值(kg)|\n"
#     res = res + "|---" * 15 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=3D7F4CB41F595FA7907F0895EDA8A053"
#            ,"202503")
# print(res)

# 区间对比
# import requests
# def main(cookie: str,srq1: str,erq1: str,srq2: str,erq2: str,):
#     url = f"http://10.84.4.74/yyqer/cqgygl/csgl/pp_qjdb_json.jsp?srq1={srq1}&erq1={erq1}&srq2={srq2}&erq2={erq2}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = f"{srq1}到{erq2}与{srq2}到{erq2}的区间对比如下："
#     res = res + "|井号|管理区|前区间日均套压MPa|前区间日均油压MPa|前区间日均压差MPa|后区间日均套压MPa|后区间日均油压MPa|后区间日均压差MPa|压差对比MPa|前区间累产万方|后区间累产万方|累产对比万方|前区间药量KG|后区间药量KG|\n"
#     res = res + "|---" * 14 + "|\n"
#     i = 0
#     for x in data:
#         if i == 50:
#             break
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#         i += 1
#
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=3D7F4CB41F595FA7907F0895EDA8A053"
#            ,"2025-04-06","2025-04-09","2025-04-12","2025-04-15")
# print(res)

# 气井免修期
# import requests
# from datetime import datetime, timedelta
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/cszb/zb_qjmxq2_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     nowDate = datetime.now()
#     data = response.json()["rs5"]
#     res = f"气井免修期如下："
#     res = res + "|井号|投产日期|下油管日期|下连油日期|检管开始日|检管结束日|免修期起|免修期止|免修期(日)|免修期(月)|\n"
#     res = res + "|---" * 10 + "|\n"
#     i = 0
#     for x in data:
#         date = datetime.strptime(x[7],"%Y-%m-%d")
#         delta = nowDate - date
#         if i == 50:
#             break
#         if delta.days < 31:
#             res = res + "|" + "|".join(x) + "|\n"
#             i += 1
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=3D7F4CB41F595FA7907F0895EDA8A053"
#            )
# print(len(res["result"]))
# print(res)

# 井下作业施工时间
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/cszb/zb_zysgsj_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["rs5"]
#     sortData = sorted(data,key = lambda x: x[3],reverse=True)
#
#     res = f"井下作业施工时间如下："
#     res = res + "|井号|投产日期|检管开始日|检管结束日|检管时间(日)|\n"
#     res = res + "|---" * 5 + "|\n"
#     i = 0
#     for x in sortData:
#         if i == 50:
#             break
#         res = res + "|" + "|".join(x) + "|\n"
#         i += 1
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=3D7F4CB41F595FA7907F0895EDA8A053"
#            )
# print(len(res["result"]))
# print(res)

# 施工一次合格率
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/cszb/zb_zyhgl_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["rs5"]
#     i = 0
#     for x in data:
#         if x[-1] == "是":
#             i += 1
#     res = f"施工一次合格率为{i/len(data)*100}%"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=3D7F4CB41F595FA7907F0895EDA8A053"
#            )
# print(len(res["result"]))
# print(res)

# 施工全优率
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/cszb/zb_zyqyl_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["rs5"]
#     i = 0
#     for x in data:
#         if x[-1] == "是":
#             i += 1
#     res = f"施工全优率为{i/len(data)*100}%"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=3D7F4CB41F595FA7907F0895EDA8A053"
#            )
# print(len(res["result"]))
# print(res)

# 返工率
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/cszb/zb_zyfgl_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["rs5"]
#     i = 0
#     for x in data:
#         if x[-1] != "否":
#             i += 1
#     res = f"返工率为{i/len(data)*100}%"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=3D7F4CB41F595FA7907F0895EDA8A053"
#            )
# print(len(res["result"]))
# print(res)

# 资料全准率
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/cszb/zb_zlqzl_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["rs5"]
#     i = 0
#     for x in data:
#         if x[-1] == "是":
#             i += 1
#     res = f"资料全准率为{i/len(data)*100}%"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=3D7F4CB41F595FA7907F0895EDA8A053"
#            )
# print(len(res["result"]))
# print(res)

# 采气时率
# import requests
# def main(cookie: str,jh: str,srq: str,erq: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/cszb/zb_scsl_json.jsp?jh={jh}&srq1={srq}&erq1={erq}&srq2=2025-04-14&erq2=2025-04-15"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = f"{srq}到{erq},{jh}的采气指标如下："
#     res = res + "|井号|区间水气比|生产时率%|\n"
#     res = res + "|---" * 3 + "|\n"
#     for x in data:
#         res = res + "|" +x[0] + "|" + x[11] + "|" + x[12] + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=3D7F4CB41F595FA7907F0895EDA8A053"
#            ,"焦页6-2HF,焦页6-10HF","2025-04-02","2025-04-15")
# print(len(res["result"]))
# print(res)

# 区块月度综合采气时率
# import requests
# def main(cookie: str,qk: str,sny: str,eny: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/cszb/zb_qkydscsl_json.jsp?srqk1={sny}&erqk1={eny}&qkdymc={qk}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = f"{sny}到{eny},{qk}的采气指标如下："
#     res = res + "|月份|区块|区间水气比|平均生产时率%|\n"
#     res = res + "|---" * 4 + "|\n"
#     for x in data:
#         res = res + "|" + x[0] + "|" + x[1] + "|" + x[9] + "|" + x[10] + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=3D7F4CB41F595FA7907F0895EDA8A053"
#            ,"涪陵南","202501","202503")
# print(len(res["result"]))
# print(res)

#区块水淹关停率
# import requests
# def main(cookie: str,qk: str,sny: str,eny: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/cszb/zb_qkydscsl_json.jsp?srqk1={sny}&erqk1={eny}&qkdymc={qk}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = f"{sny}到{eny},{qk}的采气指标如下："
#     res = res + "|月份|区块|区间水气比|平均生产时率%|\n"
#     res = res + "|---" * 4 + "|\n"
#     for x in data:
#         res = res + "|" + x[0] + "|" + x[1] + "|" + x[9] + "|" + x[10] + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=3D7F4CB41F595FA7907F0895EDA8A053"
#            ,"涪陵南","202501","202503")
# print(len(res["result"]))
# print(res)

import requests
# def main(arg1):
#     curl - X
#     POST

#     - -header
#
#     - -header
#
#     - -data - raw
#     '{
#     "inputs": {},
#     "query": "What are the specs of the iPhone 13 Pro Max?",
#     "response_mode": "streaming",
#     "conversation_id": "",
#     "user": "abc-123",
#     "files": [
#         {
#             "type": "image",
#             "transfer_method": "remote_url",
#             "url": "https://cloud.dify.ai/logo/logo-site.png"
#         }
#     ]
#
# }'
#     class_url = "http://10.85.2.51/v1/chat-messages"
#     class_headers = {
#         'Authorization': 'Bearer app-AypDPZSqa2hbZLNsiiXr87kp',
#         'Content-Type': 'application/json'
#     }
#     class_data = {
#         "inputs": {},
#         "query": f"{arg1}",
#         "response_mode": "blocking",
#         "conversation_id": "",
#         "user": "yy123",
#         "files": []
#     }
#
#     class_response = requests.post(class_url, headers=class_headers, json=class_data, timeout=50)
#     print(class_response.json())
#     return {
#         "result": class_response.json()["answer"],
#     }
#
# res = main("查询采气异常")
# print(res)

# import requests
# def main(cookie: str,jh: str,rq: str):
#     url = f"http://10.84.4.74/yyqer/qcgc/kfxz/kfxz_scyl_json.jsp?rq={rq}"
#     jhs = jh.split(",")
#     Dict = {}
#     for x in jhs:
#         Dict[x] = 1
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()
#     res = f"{rq},{jh}的开发现状如下："
#     res = res + "|井号|生产压力|外输压力|产气量|产水量|水气比|\n"
#     res = res + "|---" * 6 + "|\n"
#     for x in data:
#         if x["jh"] in Dict:
#             res = res + "|" + x["jh"] + "|" + x["scyl"] + "|" + x["sqyl"] + "|" + x["rcql"] + "|" + x["rcsl"] + "|" + x["sqb"] + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=022F0DC95CEB6D00A77496A14E124C0A"
#            ,"焦页1-2HF,焦页1-3HF,焦页1-4HF","2025-04-14")
# print(res)
# print(len(res["result"]))

# import requests
# def main(cookie: str,jh :str):
#     url = f"http://10.84.4.74/yyqer/kfdtgl/djfx/djclcl_json.jsp?jhs={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["rs"]
#     res = f"{jh}的产能储量基础信息如下：\n"
#     res = res + "|井号|单井产能方案设计值(万方/天)|新建产能方案设计值(万方/天)|单井技术可采储量方案设计值(万方/天)|单井动用面积|实际单井动用储量|单井动用地质储量(亿方)|新建产能核定标定年份|新建产能核定单井产能(万方/天)|新建产能核定保有产能(万方/天)|新建产能核定新建产能(万方/天)|2023年底标定值单井技术可采储量(亿方)|2023年底标定值单井经济可采储量(亿方)|\n"
#     res = res + "|---" * 13 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[5:18]) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=022F0DC95CEB6D00A77496A14E124C0A"
#            ,"焦页1-S10HF,焦页1-S6HF,焦页2-2HF")
# print(res)
# print(len(res["result"]))

# import requests
# def main(cookie: str,jh: str):
#     url = f"http://10.84.4.74/yyqer/scbb/cqscdt/cqscdt_yltj_json.jsp?"
#     response = requests.get(url, headers={"cookie": cookie})
#     jhs = jh.split(",")
#     Dict = dict()
#     for x in jhs:
#         Dict[x] = 1
#     data = response.json()["data"]
#     res = f"{jh}的压力分析如下：\n"
#     res = res + "|井号|压力≥10MPa时日产10⁴m³/d|压力≥10MPa时累产10⁴m³|压力<10MPa时日产10⁴m³/d|压力<10MPa时累产10⁴m³|压力≥7MPa时日产10⁴m³/d|压力≥7MPa时累产10⁴m³|压力<7MPa时日产10⁴m³/d|压力<7MPa时累产10⁴m³|10MPa-9MPa时日产10⁴m³/d|10MPa-9MPa时累产10⁴m³|9MPa-8MPa时日产10⁴m³/d|9MPa-8MPa时累产10⁴m³|8MPa-7MPa时日产10⁴m³/d|8MPa-7MPa时累产10⁴m³|7MPa-6MPa时日产10⁴m³/d|7MPa-6MPa时累产10⁴m³|6MPa-5MPa时日产10⁴m³/d|6MPa-5MPa时累产10⁴m³|5MPa-目前时日产10⁴m³/d|5MPa-目前时累产10⁴m³|\n"
#     res = res + "|---" * 21 + "|\n"
#     for x in data:
#         if x[0] in jhs:
#             res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }
# res = main("userName=wjx2023.jhyt; password=; JSESSIONID=022F0DC95CEB6D00A77496A14E124C0A"
#            ,"焦页1HF,焦页1-S10HF")
# print(res)
# print(len(res["result"]))

# import requests
# def main(cookie: str):
#     url = "http://10.84.4.74/yyqer/sqgc/dhc/yldt_json.jsp"
#     response = requests.post(url, headers={"cookie": cookie})
#     print(response.json())
#     data = response.json()["data"]
#     res = "下面的数据中，阶段为压裂表示这是正在压的井，阶段为试气表示这是试气井，否则表示这是待压井：\n"
#     res = res + "|井号|单位|队号|开工日期|设计段数|已完成段数|下步工序|阶段|\n"
#     res = res + "|---" * 8 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#     return {
#         "result": res,
#     }
#
# res = main("SrWellSelector.dateselected=; SrWellSelector.glqselected=; SrWellSelector.qkdyselected=; SrWellSelector.dwmcselected=; MyPagenav.menu=cjgzgl/menu_ylgz.jsp; MyPagenav.menutype=topnav_menu_right; MyPagenav.curpage=sqgc/dhc/sqdhc.html; userName=wang_q.jhyt; password=Qwer1001; saveCookie=true; JSESSIONID=25A30ACFEFF52E6BAD9BDD6254E6B8E4; MyPagenav.topmenu=cjgzgl/topmenu.jsp")
# print(res)
#
# def main():
#     import requests
#     url = "http://10.85.2.51/v1/workflows/run"
#     headers = {
#         "Authorization": "Bearer app-x5AihXy2orUTpUg6V7WeYeCQ",
#         "Content-Type": "application/json"
#     }
#     data = {
#         "inputs": {},
#         "response_mode": "blocking",
#         "user": "yy-123"
#     }
#
#     response = requests.post(url, headers=headers, json=data)
#     response = response.json()["data"]["outputs"]["cookie"]
#
#     return "SrWellSelector.dateselected=; SrWellSelector.glqselected=; SrWellSelector.qkdyselected=; SrWellSelector.dwmcselected=; MyPagenav.menu=cjgzgl/menu_ylgz.jsp; MyPagenav.menutype=topnav_menu_right; MyPagenav.curpage=sqgc/dhc/sqdhc.html; userName=wang_q.jhyt; password=Qwer1001; saveCookie=true; JSESSIONID=25A30ACFEFF52E6BAD9BDD6254E6B8E4; MyPagenav.topmenu=cjgzgl/topmenu.jsp"

# def main():
#     import requests
#     url = "http://10.85.2.51/v1/chat-messages"
#     headers = {
#         "Authorization": "Bearer app-f9bwKfXOufF73Rnb5UuboEMw",
#         "Content-Type": "application/json"
#     }
#     data = {
#         "inputs": {},
#         "query": "1",
#         "response_mode": "blocking",
#         "conversation_id": "",
#         "user": "abc-123",
#         "files": []
#     }
#
#     response = requests.post(url, headers=headers, json=data)
#     response = response.json()["answer"]
#     return {
#         "cookie": response,
#     }
#
# res = main()
# print(res)

# 获取cookie
# import requests
# import json
# def main():
#     JSESSIONID = requests.post('http://10.84.4.74/yyqer/login.jsp', data={'name': 'wlx2023.jhyt', 'pwd': '65154E8BFDC8C394424E31A390816707047B38D16805AD551D36D9862A3003C6'}, verify=False).cookies.get_dict()['JSESSIONID']
#     cookie = 'userName=wjx2023.jhyt; password=; JSESSIONID={}'.format(JSESSIONID)
#     return {
#         "cookie": cookie
#     }
# import requests
# import json
# def main():
#     JSESSIONID = requests.post('http://10.85.2.51:8112/get-cookie', verify=False).json()
#     print(JSESSIONID)
#     return {
#         "cookie": JSESSIONID
#     }
#
# res = main()
# print(res)

# import requests
# def main(cookie: str,qk: str,nd: str):
#     url = f"http://10.84.4.74/yyqer/qcgc/cnzb/jhwcqk_json.jsp?qk={qk}&nd={nd}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     gzmb = response.json()["gzmb"]
#     res = f"{nd},{qk}的工作目标如下\n"
#     res = res + "|月份|日销气量|日产量|月产量|\n"
#     res = res + "|---" * 4 + "|\n"
#     i = 1
#     for i in range(1,13):
#         res = res + "|" + f"{i}月" + "|" + gzmb[0][i] + "|" + gzmb[1][i] +"|" + gzmb[2][i] + "|\n"
#
#     fdmb = response.json()["fdmb"]
#     res = res + f"{nd},{qk}的奋斗目标如下\n"
#     res = res + "|月份|日销气量|日产量|月产量|\n"
#     res = res + "|---" * 4 + "|\n"
#     i = 1
#     for i in range(1, 13):
#         res = res + "|" + f"{i}月" + "|" + fdmb[0][i] + "|" + fdmb[1][i] + "|" + fdmb[2][i] + "|\n"
#
#     scsj = response.json()["scsj"]
#     res = res + f"{nd},{qk}的实际生产如下\n"
#     res = res + "|月份|日销气量|月销气量|日产气量|月产气量|\n"
#     res = res + "|---" * 5 + "|\n"
#     i = 1
#     for x in scsj:
#         res = res + "|" +x[0]  + "|" + "|".join(x[2:]) + "|\n"
#
#     return {
#         "result": res,
#     }
# def main():
#     import requests
#     url = "http://10.85.2.51/v1/workflows/run"
#     headers = {
#         "Authorization": "Bearer app-x5AihXy2orUTpUg6V7WeYeCQ",
#         "Content-Type": "application/json"
#     }
#     data = {
#         "inputs": {},
#         "response_mode": "blocking",
#         "user": "yy-123"
#     }
#
#     response = requests.post(url, headers=headers, json=data)
#     response = response.json()["data"]["outputs"]["cookie"]
#     return {
#         "cookie": response,
#     }
# res = main()
# print(res)

# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/yjpj/kyxfx/kyxdb_json.jsp?jh={jh}&ljjl=2000&fxlx=null"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res3"]
#     data2 = response.json()["res4"]
#     res = f"{jh}与邻井的对比如下：\n"
#     res = res + "|井号|水平段长|垂深范围|平均垂深|粘土矿物范围|平均黏土矿物|地层密度方位|平均底层密度|含气饱和度范围|平均含气饱和度|类型|距离|无阻流量|\n"
#     res = res + "|---" * 13 + "|\n"
#     i = 0
#     for x in data:
#         if i == 50:
#             break
#         res = res + "|" + "|".join(x) + "|\n"
#         i += 1
#     res = res + "|" + "|".join(data2[0]) + "|\n"
#     print(i)
#     return {
#         "result": res,
#     }

# import requests
# def main(cookie: str,jh: str):
#     url = f"http://10.84.4.74/yyqer/yjpj/kyxfx/kyxjhpj_json.jsp?"
#     response = requests.get(url, headers={"cookie": cookie})
#     jhs = jh.split(",")
#     Dict = {}
#     for x in jhs:
#         Dict[x] = 1
#     data = response.json()["resd1"]
#     res = "{jh}的人机交互评价如下：\n"
#     res = res + "|井号|垂深|脆性矿物|粘土矿物|地层密度|推荐评价|人工评价|机器评价|\n"
#     res = res + "|---" * 8 + "|\n"
#     for x in data:
#         if x[0] in Dict:
#             res = res + "|" + x[0] +"|" + "|".join(x[2:]) + "|\n"
#     return {
#         "result": res,
#     }

# import requests
# from datetime import datetime
# def main(cookie: str):
#     nowDate = datetime.now()
#     nd = nowDate.strftime("%Y")
#     url = f"http://10.84.4.74/yyqer/dtjc/sjtj/sjtj_yxball_json.jsp?nd={nd}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = "运行表如下:\n"
#     res = res + "|年月|流压|静压|产能试井|压力恢复|产剖测试|气分析|水分析|气质分析|合计|\n"
#     res = res + "|---" * 10 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#
#     return {
#         "result": res,
#     }

# import requests
# from datetime import datetime,timedelta
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/sjtj/sjtj_ylcsjhb_json.jsp?lx=测流压"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = "|井号|投产日期|描述|频率|最近测试日期|4月|5月|6月|7月|8月|9月|10月|11月|12月|\n"
#     res = res + "|---" * 13 + "|\n"
#     nowDate = datetime.now()
#     i = 0
#     for x in data:
#         if x[4] == "":
#             continue
#         if i == 100:
#             break
#         date = datetime.strptime(x[4],"%Y-%m-%d")
#         diff = nowDate - date
#         if diff.days < 30:
#             res = res + "|" + "|".join(x) + "|\n"
#             i += 1
#     return {
#         "result": res,
#     }
# import requests
# from datetime import datetime,timedelta
# def main(cookie: str,jh: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/yljc/yl_dj_sj.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["res"]
#     res = f"{jh}的单井测压信息如下"
#     res = res + "|层位|测试目的|测压日期|套压MPa|油压MPa|气产量10⁴m³/d|井口温度℃|仪器型号及编号|仪器量程MPa|仪器精度%|井深m|垂深m|压力MPa|压力梯度MPa/100m|温度℃|温度梯度℃/100m|气层中部深度m|液面深度m|气层中部压力MPa|压力系数|备注|\n"
#     res = res + "|---" * 21 + "|\n"
#     i = 0
#     nowDate = datetime.now()
#     for x in data:
#         if x[3] == "":
#             continue
#         if i == 50:
#             break
#         date = datetime.strptime(x[3],"%Y-%m-%d")
#         diff = nowDate - date
#         if diff.days < 730:
#             res = res + "|" + "|".join(x[1:]) + "|\n"
#             i += 1
#     print(i)
#     return {
#         "result": res,
#     }

# import requests
# from datetime import datetime,timedelta
# def main(cookie: str,jh: str):
#     nowDate = datetime.now()
#     preDate = nowDate - timedelta(days = 365)
#     erq = nowDate.strftime("%Y-%m-%d")
#     srq = preDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/dtjc/cym_json.jsp?jh={jh}&srq={srq}&erq={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"{jh}的测液面数据如下："
#     res = res + "|井号|油管内径mm|油管外径mm|完井管柱下入深度m|完井管柱底部位置(井斜角)|测试日期|仪器型号|套压MPa|油压MPa|产气量104m3|气层中部深度m|液面深度m|液面垂深m|压力计下入井深m|测压液面深度m|推算静压MPa|备注|测试单位|\n"
#     res = res + "|---" * 17 + "|\n"
#     i = 0
#     for x in data:
#         if i == 50:
#             break
#         res = res + "|" + "|".join(x) + "|\n"
#         i += 1
#     return {
#         "result": res,
#     }

# import requests
# from datetime import datetime,timedelta
# def main(cookie: str):
#     nowDate = datetime.now()
#     preDate = nowDate - timedelta(days = 30)
#     erq = nowDate.strftime("%Y-%m-%d")
#     srq = preDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/dtjc/rylzfx_json.jsp?srq={srq}&erq={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"溶液离子数据如下："
#     res = res + "|井号|管理区|层位|井段顶深|井段底深|样品编号|样品描述|分析人|审核人|取样日期|分析日期|分析类型|PH值|水相对密度(g/ml)|Li⁺|K⁺|Na⁺|KNa⁺|NH₄⁺|Ca²⁺|Mg²⁺|Ba²⁺|Sr²⁺|阳离子总值|F⁻|Cl⁻|Br⁻|I⁻|NO₃⁻|SO₄²⁻|HCO₃⁻|CO₃²⁻|OH⁻|	阴离子总量|总矿化度(mg/l)|水型|备注|投产日期|累产天数|累产气量10⁴m³|累产水量m³|取样单位|取样人|取样部位|\n"
#     res = res + "|---" * 44 + "|\n"
#     i = 0
#     for x in data:
#         if i ==20:
#             break
#         res = res + "|" + "|".join(x) + "|\n"
#         i += 1
#     return {
#         "result": res,
#     }

# import requests
# from datetime import datetime
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/cpqfx_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     nowDate = datetime.now() # 获取当前日期
#     res = f"气质分析数据如下："
#     res = res + "|名称|样品编号|取样日期|取样单位|取样位置|取样人|分析人|审批人|分析日期|高位发热量MJ/m³|硫化氢mg/m³|总硫mg/m³|历年最低环境温度℃|管输压力Mpa|露点℃|二氧化碳%|检测结论|检测单位|备注|\n"
#     res = res + "|---" * 19 + "|\n"
#     i = 0
#     for x in data:
#         if x[2] == "":
#             continue
#         if i == 40:
#             break
#         date = datetime.strptime(x[2],"%Y-%m-%d") #获取本行数据的取样日期
#         diff = nowDate - date # 获取差值
#         if diff.days < 90:
#             res = res + "|" + "|".join(x) + "|\n"
#             i += 1
#     return {
#         "result": res,
#     }

# import requests
# def main(cookie: str,jh: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/twshz/tws_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"{jh}的同位素数据如下："
#     res = res + "|井号|生产井段(m)|层位|取样日期|取样部位|取样压力|气体组分摩尔(%)CH₄|气体组分摩尔(%)C₂H₆|气体组分摩尔(%)C₃H₈|气体组分摩尔(%)CO₂|气体组分摩尔(%)N₂|ΣnC1+~nC5|气体组分摩尔(%)-干燥系数|δC13‰-CO₂|δC13‰-CH₄|δC13‰-C₂H₆|δC13‰-C₃H₈|δC13‰-iC₄|δC13‰-nC₄|投产日期|\n"
#     res = res + "|---" * 20 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[:6]) +"|" +"|".join(x[8:22]) + "|\n"
#     return {
#         "result": res,
#     }

# import requests
# from datetime import datetime
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/xjfx_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     nowDate = datetime.now() # 获取当前日期
#     res = f"细菌数据如下："
#     res = res + "|井号|层位|井段顶深|井段底深|样品编号|颜色|嗅|沉淀情况|透明度|取样单位|取样人|取样位置|取样日期|分析日期|分析人|审核人|腐生菌|硫酸盐还原菌|铁细菌|备注|\n"
#     res = res + "|---" * 19 + "|\n"
#     i = 0
#     for x in data:
#         if x[12] == "":
#             continue
#         if i == 40:
#             break
#         date = datetime.strptime(x[12],"%Y-%m-%d") #获取本行数据的取样日期
#         diff = nowDate - date # 获取差值
#         if diff.days < 31:
#             res = res + "|" + "|".join(x) + "|\n" #获取30天内的数据
#             i += 1
#     return {
#         "result": res,
#     }
# import requests
# from datetime import datetime
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/rysfx_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     nowDate = datetime.now() # 获取当前日期
#     res = f"溶液水数据如下："
#     res = res + "|井号|样品编号|取样单位|取样人|取样位置|分析人|审核人|取样日期|分析日期|水质量分数浓度%|备注|\n"
#     res = res + "|---" * 11 + "|\n"
#     i = 0
#     for x in data:
#         if x[10] == "":
#             continue
#         if i == 50:
#             break
#         date = datetime.strptime(x[10],"%Y-%m-%d") #获取本行数据的取样日期
#         diff = nowDate - date # 获取差值
#         if diff.days < 365:
#             res = res + "|" + x[0] + "|" + "|".join(x[4:]) + "|\n"
#             i += 1
#     return {
#         "result": res,
#     }

# import requests
# def main(cookie: str,jh: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/fdqs/fdqs_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"{jh}的产剖测试数据如下："
#     res = res + "|段|斜深1|斜深2|垂深1|垂深2|各级产水量(方/天)|各簇产水量(方/天)|各簇产水量占百分比(%)|各级产水量占百分比(%)|各级产气量(方/天)|各簇产气量(方/天)|各簇产气量占百分比(%)|各级产气量占百分比(%)|簇内平均温度|簇内平均压力|\n"
#     res = res + "|---" * 15 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }

# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/ylhh/ylhf_jcsj_json.jsp?"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"压力恢复测试数据如下："
#     res = res + "|井号|关井前气产量10⁴m³/d|关井前水产量m³/d|关井时刻油压Mpa|关井时刻套压Mpa|关井时刻井底流压Mpa|关井时刻最高恢复压力Mpa|开井阶段累计产气量10⁴m³/d|开井阶段生产时间h|关井时间h|备注|\n"
#     res = res + "|---" * 11 + "|\n"
#     i = 0
#     for x in data:
#         if i == 40:
#             break
#         res = res + "|" + x[0] + "|" + "|".join(x[12:]) + "|\n"
#         i += 1
#     return {
#         "result": res,
#     }

# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/wzrcs_jcsj_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"微注入测试数据如下："
#     res = res + "|井号|测试时间|测试单位|层位|射孔井段深度m|测试层位|压力计位置m|仪器型号及编号|压力计精度%|压力计量程MPa|压力计数量|注入排量L/min|注入量m³|施工压力MPa|停泵压力MPa|最终关井井口压力MPa|总关井时间h|备注|\n"
#     res = res + "|---" * 18 + "|\n"
#     i = 0
#     for x in data:
#         if i == 40:
#             break
#         res = res + "|" + "|".join(x) + "|\n"
#         i += 1
#     return {
#         "result": res,
#     }
# import requests
# from datetime import datetime,timedelta
# def main(cookie: str,jh: str):
#     nowDate = datetime.now()
#     preDate = nowDate - timedelta(days = 90)
#     erq = nowDate.strftime("%Y-%m-%d")
#     srq = preDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/dtjc/yljc/yl_hz_json.jsp?jh={jh}&srq={srq}&erq={erq}&cylx=测流压"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"{jh}压力汇总数据如下："
#     res = res + "|井号|层位|测试目的|测压日期|套压MPa|油压MPa|气产量10⁴m³/d|测压日产水量m³/d|测压日累产气量10⁴m³|测压日累产水量m3|井口温度℃|气层中部深度m|液面深度m|气层中部压力MPa|气层中部温度℃|气层中部压力/井口套压|最大压力梯度MPa/100m|压力系数|区块|测试单位|备注|\n"
#     res = res + "|---" * 21 + "|\n"
#     i = 0
#     for x in data:
#         if i == 40:
#             break
#         res = res + "|" + "|".join(x) + "|\n"
#         i += 1
#     return {
#         "result": res,
#     }

# import requests
# from datetime import datetime,timedelta
# def main(cookie: str,jh: str):
#     nowDate = datetime.now()
#     preDate = nowDate - timedelta(days = 90)
#     erq = nowDate.strftime("%Y-%m-%d")
#     srq = preDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/dtjc/qfx/qfx_json.jsp?jh={jh}&srq={srq}&erq={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"{jh}的气分析数据如下："
#     res = res + "|管理区|井号|层位|井段顶深|井段底深|样品编号|样品描述|取样单位|取样人|取样部位|分析人|审核人|取样日期|化验日期|相对密度|临界温度K|临界压力Mpa|摩尔质量|压缩因子|硫化氢mg/m³|二氧化碳g/m³|氦气|氢气|氮气|二氧化碳|硫化氢|甲烷|乙烷|丙烷|异丁烷|正丁烷|异戊烷|正戊烷|己烷|备注|投产日期|累产天数|累产气量10⁴m³|累产水量m³|\n"
#     res = res + "|---" * 39 + "|\n"
#     i = 0
#     for x in data:
#         if i == 20 :
#             break
#         res = res + "|" + "|".join(x) + "|\n"
#         i += 1
#     return {
#         "result": res,
#     }

# import requests
# def main(cookie: str,jh: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/yfx_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["res"]
#     res = f"{jh}的油分析数据如下："
#     res = res + "|层位|井段顶深|井段底深|样品编号|颜色|嗅|沉淀情况|透明度|取样单位|取样人|取样位置|取样日期|测试日期|水含量(%)|标准密度(kg/m³)|投产日期|累产天数|累产气量10⁴m³|累产油量t|累产水量m³|备注|\n"
#     res = res + "|---" * 21 + "|\n"
#     i = 0
#     for x in data:
#         if i == 50:
#             break
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#         i += 1
#     return {
#         "result": res,
#     }

# import requests
# def main(cookie: str,jh: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/yzffx_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["res"]
#     res = f"{jh}的油组分析数据如下："
#     res = res + "|层位|样品类型|取样位置|取样日期|分析日期|分析单位|C1|C2|C3|C4|C5|C6|C7|C8|C9|C10|C11|C12|C13|C14|C15|C16|C17|C18|C19|C20|C21|C22|C23|C24|C25|C26|C27|C28|C29|C30|C31|C32|C33|C34|C35|C36|C37|C38|C39|C40|C41|C42|C43|Pr|Ph|甲基环已烷指数%|环已烷指数%|苯指数%|环烷指数%|庚烷值%|石蜡指数|OEP值|Pr/Ph|Pr/n-C17|Ph/n-C18|(C21+C22)/(C28+C29)|∑C21-/∑C22+|投产日期|累产天数|累产气量10⁴m³|累产油量t|累产水量m³|备注|\n"
#     res = res + "|---" * 69 + "|\n"
#     i = 0
#     for x in data:
#         if i == 30:
#             break
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#         i += 1
#     return {
#         "result": res,
#     }

#import requests
# from datetime import datetime,timedelta
# def main(cookie: str,jh: str):
#     nowDate = datetime.now()
#     preDate = nowDate - timedelta(days = 90)
#     erq = nowDate.strftime("%Y-%m-%d")
#     srq = preDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/dtjc/sfxhz/sfx_json.jsp?jh={jh}&srq={srq}&erq={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"{jh}的水分析数据如下："
#     res = res + "|井号|管理区|层位|井段顶深|井段底深|样品编号|样品描述|取样日期|分析日期|分析人|审核人|分析类型|PH值|水相对密度(g/ml)|Li⁺|K⁺|Na⁺|KNa⁺|NH₄⁺|Ca²⁺|Mg²⁺|Ba²⁺|Sr²⁺|阳离子总值|F⁻|Cl⁻|Br⁻|I⁻|NO₃⁻|SO₄²⁻|HCO₃⁻|CO₃²⁻|OH⁻|阴离子总量|总矿化度(mg/l)|水型|备注|投产日期|累产天数|累产气量10⁴m³|累产水量m³|取样单位|取样人|取样部位|\n"
#     res = res + "|---" * 44 + "|\n"
#     i = 0
#     for x in data:
#         if i == 20:
#             break
#         res = res + "|" + "|".join(x) + "|\n"
#         i += 1
#     return {
#         "result": res,
#     }

# import requests
# from datetime import datetime
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/glsj_list.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     nowDate = datetime.now() # 获取当前日期
#     res = f"刮蜡数据如下："
#     res = res + "|井号|刮蜡日期|套压(MPa)|油压(MPa)|刮蜡深度(m)|刮蜡量(Kg)|刮蜡时长(min)|备注|\n"
#     res = res + "|---" * 8 + "|\n"
#     i = 0
#     for x in data:
#         if i ==100:
#             break
#         if x["RQ"] == "":
#             continue
#         date = datetime.strptime(x["RQ"],"%Y-%m-%d") #获取本行数据的取样日期
#         diff = nowDate - date # 获取差值
#         if diff.days < 30:
#             res = res + "|" + x["JH"] + "|" + x["RQ"] + "|" + x["TY"] + "|" + x["YY"] + "|" + x["GLSD"] + "|" + x["GLL"] + "|" + x["GLSC"] + "|" + x["BZ"] + "|\n"
#             i += 1
#     return {
#         "result": res,
#     }
# import requests
# def main(cookie: str,jh: str):
#     url = f"http://10.84.4.74/yyqer/sqgc/zhfx/wdzjc_json.jsp?jh={jh}&jcfs=地面监测"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["res"]
#     res = f"{jh}的微地震监测数据如下："
#     res = res + "|压裂段|穿行层位|微地震事件数目|西翼裂缝网络长(米)|东翼裂缝网络长(米)|总长度(m)|西翼裂缝网络宽(米)|东翼裂缝网络宽(米)|平均宽度(m)|长宽比|高度(m)|裂缝网络走向|储层改造体积(10⁴m³)|监测距离|\n"
#     res = res + "|---" * 14 + "|\n"
#     i = 0
#     for x in data:
#         if i == 50:
#             break
#         res = res + "|" + "|".join(x[:-1]) + "|\n"
#         i += 1
#     return {
#         "result": res,
#     }

# import requests
# from datetime import datetime
# def main(cookie: str,jh: str):
#     nowDate = datetime.now()
#     rq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/qcgc/kfxz/kfxz_scyl_json.jsp?rq={rq}"
#     jhs = jh.split(",")
#     Dict = {}
#     for x in jhs:
#         Dict[x] = 1
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()
#     res = f"{jh}的开发现状如下：\n"
#     res = res + "|井号|生产压力|外输压力|产气量|产水量|水气比|\n"
#     res = res + "|---" * 6 + "|\n"
#     for x in data:
#         if x["jh"] in Dict:
#             res = res + "|" + x["jh"] + "|" + x["scyl"] + "|" + x["sqyl"] + "|" + x["rcql"] + "|" + x["rcsl"] + "|" + x["sqb"] + "|\n"
#     return {
#         "result": res,
#     }

# import requests
# from datetime import datetime,timedelta
# def main(cookie: str, jh: str):
#     nowDate = datetime.now()
#     preDate = nowDate - timedelta(days = 90)
#     erq = nowDate.strftime("%Y%m")
#     srq = preDate.strftime("%Y%m")
#     url = f"http://10.84.4.74/yyqer/qcgc/cnzb/sczb_qx_json.jsp?jh={jh}&srq={srq}&erq={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = f"{jh}的生产指标如下：\n"
#     res = res + "|日期|总井数|开井数|老井日产气|新井日产气|老井日产水|新井日产水|套压|油压|输压|新井套压|新井油压|老井套压|老井油压|\n"
#     res = res + "|---" * 14 + "|\n"
#     i = 0
#     for x in data:
#         if i == 100:
#             break
#         res = res + "|" + "|".join(x[0:7]) + "|" +  "|".join(x[9:]) + "|\n"
#         i += 1
#     return {
#         "result": res,
#     }
#
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/qcgc/kfzb/djkfzb_json.jsp?jhs={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["rs"]
#     res = f"{jh}的产能指标如下：\n"
#     res = res + "|井号|动用储量(10⁸m³)|技术可采储量(10⁸m³)|剩余技术可采储量(10⁸m³)|动用储量采出程度(%)|技术可采储量采出程度(%)|动用储量采气速度(%)|技术可采储量采气速度(%)|剩余可采储量采气速度(%)|区块产能(10⁸m³)|产能负荷因子|总水气比(m³/10⁴m³)|储采比|单位压降产量(10⁴m³/MPa)|自然递减率(%)|套压同比压降值(MPa)|油压同比压降值(MPa)|\n"
#     res = res + "|---" * 18 + "|\n"
#     i = 0
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#         i += 1
#     print(i)
#     return {
#         "result": res,
#     }

# import requests
# def main(cookie: str,jh :str):
#     url = f"http://10.84.4.74/yyqer/kfdtgl/djfx/djclcl_json.jsp?jhs={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["rs"]
#     res = f"{jh}的产能储量基础信息如下：\n"
#     res = res + "|井号|单井产能方案设计值(万方/天)|新建产能方案设计值(万方/天)|单井技术可采储量方案设计值(万方/天)|单井动用面积|实际单井动用储量|单井动用地质储量(亿方)|新建产能核定标定年份|新建产能核定单井产能(万方/天)|新建产能核定保有产能(万方/天)|新建产能核定新建产能(万方/天)|2023年底标定值单井技术可采储量(亿方)|2023年底标定值单井经济可采储量(亿方)|\n"
#     res = res + "|---" * 13 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[5:18]) + "|\n"
#     return {
#         "result": res,
#     }
# import requests
# from datetime import datetime,timedelta
# def main(cookie: str,qk: str,):
#     nowDate = datetime.now()
#     nd1 = nowDate.strftime("%Y")
#     url = f"http://10.84.4.74/yyqer/qcgc/cnzb/cxqk_json.jsp?qk={qk}&nd1={nd1}&nd2={nd1}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"{qk}当前产销情况如下\n"
#     res = res + "|日期|天数|产量(万方)|销量(万方)|日产量(万方)|日销量(万方)|同比产量(万方)|同比销量(万方)|产油量(吨)|销售油量(吨)|日产油(吨)|日销油(吨)|同比产油量(吨)|同比销油量(吨)|\n"
#     res = res + "|---" * 14 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#
#     return {
#         "result": res,
#     }

# import requests
# from datetime import datetime,timedelta
# def main(cookie: str,qk: str):
#     nowDate = datetime.now()
#     nd = nowDate.strftime("%Y")
#     url = f"http://10.84.4.74/yyqer/qcgc/cnzb/jhwcqk_json.jsp?qk={qk}&nd={nd}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     gzmb = response.json()["gzmb"]
#     res = f"{qk}的工作目标如下\n"
#     res = res + "|月份|日销气量|日产量|月产量|\n"
#     res = res + "|---" * 4 + "|\n"
#     i = 1
#     for i in range(1,13):
#         res = res + "|" + f"{i}月" + "|" + gzmb[0][i] + "|" + gzmb[1][i] +"|" + gzmb[2][i] + "|\n"
#
#     fdmb = response.json()["fdmb"]
#     res = res + f"{qk}的奋斗目标如下\n"
#     res = res + "|月份|日销气量|日产量|月产量|\n"
#     res = res + "|---" * 4 + "|\n"
#     i = 1
#     for i in range(1, 13):
#         res = res + "|" + f"{i}月" + "|" + fdmb[0][i] + "|" + fdmb[1][i] + "|" + fdmb[2][i] + "|\n"
#
#     scsj = response.json()["scsj"]
#     res = res + f"{qk}的实际生产如下\n"
#     res = res + "|月份|日销气量|月销气量|日产气量|月产气量|\n"
#     res = res + "|---" * 5 + "|\n"
#     i = 1
#     for x in scsj:
#         res = res + "|" + "|".join(x[2:]) + "|\n"
#
#     return {
#         "result": res,
#     }

# import requests
# from datetime import datetime,timedelta
# def main(cookie: str,jh: str):
#     nowDate = datetime.now()
#     rq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/scbb/r_rddb_json.jsp?jhs={jh}&rq={rq}&tz="
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"{jh}的日度产量对比如下:\n"
#     res = res + "|井号|昨日气产量m³|今日气产量m³|△气产量m³|%|\n"
#     res = res + "|---" * 5 + "|\n"
#     for x in data:
#         res = res + "|" + x[5] + "|" + "|".join(x[11:15]) + "|\n"
#
#     return {
#         "result": res,
#     }

# import requests
# def main(cookie: str,jh: str):
#     url = f"http://10.84.4.74/yyqer/scbb/cqscdt/cqscdt_yltj_json.jsp?"
#     response = requests.get(url, headers={"cookie": cookie})
#     jhs = jh.split(",")
#     Dict = dict()
#     for x in jhs:
#         Dict[x] = 1
#     data = response.json()["data"]
#     res = f"{jh}的压力分析如下：\n"
#     res = res + "|井号|压力≥10MPa时日产10⁴m³/d|压力≥10MPa时累产10⁴m³|压力<10MPa时日产10⁴m³/d|压力<10MPa时累产10⁴m³|压力≥7MPa时日产10⁴m³/d|压力≥7MPa时累产10⁴m³|压力<7MPa时日产10⁴m³/d|压力<7MPa时累产10⁴m³|10MPa-9MPa时日产10⁴m³/d|10MPa-9MPa时累产10⁴m³|9MPa-8MPa时日产10⁴m³/d|9MPa-8MPa时累产10⁴m³|8MPa-7MPa时日产10⁴m³/d|8MPa-7MPa时累产10⁴m³|7MPa-6MPa时日产10⁴m³/d|7MPa-6MPa时累产10⁴m³|6MPa-5MPa时日产10⁴m³/d|6MPa-5MPa时累产10⁴m³|5MPa-目前时日产10⁴m³/d|5MPa-目前时累产10⁴m³|\n"
#     res = res + "|---" * 21 + "|\n"
#     for x in data:
#         if x[0] in jhs:
#             res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }

# import requests
# from datetime import datetime,timedelta
# def main(cookie: str):
#     nowDate = datetime.now()
#     preDate = nowDate - timedelta(days = 1)
#     erq = nowDate.strftime("%Y-%m-%d")
#     srq = preDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/kfdtgl/sjtj_json.jsp?srq={srq}&erq={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["res"]
#     res = f"气田产量如下："
#     res = res + "|日期|一区流量(万方)|二区流量(万方)|三区流量(万方)|四区流量(万方)|合计(万方)|\n"
#     res = res + "|---" * 6 + "|\n"
#     i = 0
#     for x in data:
#         if i == 80:
#             break
#         res = res + "|" + "|".join(x) + "|\n"
#         i += 1
#     return {
#         "result": res,
#     }

# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/kfdtgl/fstj_json.jsp?glq=一区"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["rs"]
#     res = f"集气站产量如下："
#     res = res + "|集气站|8:00|9:00|10:00|11:00|12:00|13:00|14:00|15:00|16:00|17:00|18:00|19:00|20:00|\n"
#     res = res + "|---" * 14 + "|\n"
#     i = 0
#     for x in data:
#         if i == 50:
#             break
#         res = res + "|" + "|".join(x[:14]) + "|\n"
#         i += 1
#     return {
#         "result": res,
#     }

# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/kfdtgl/clgl/qtxl_json.jsp?"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["res"]
#     res = f"气田销量数据如下："
#     res = res + "|日期|乌江北销量|乌江南销量|白马销量|平桥销量|合计(万方)|\n"
#     res = res + "|---" * 6 + "|\n"
#     i = 0
#     for x in data:
#         if i == 50:
#             break
#         if x[0] == None:
#             break
#         res = res + "|" + "|".join(x) + "|\n"
#         i += 1
#     return {
#         "result": res,
#     }
# import requests
# def main(cookie: str,jh: str):
#     jhs = jh.split(",")
#     url = f"http://10.84.4.74/yyqer/sssj/djssyj_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"{jh}的实时预警如下："
#     res = res + "|井号|最小压力Mpa|最大压力Mpa|压力波动幅度|最小输压Mpa|最大输压|输压波动幅度|\n"
#     res = res + "|---" * 7 + "|\n"
#     for x in data:
#         for y in jhs:
#             if y in x[1]:
#                 res = res + "|" + "|".join(x[1:]) + "|\n"
#     return {
#         "result": res,
#     }
# import requests
# from datetime import datetime
# def main(cookie: str):
#     nowDate = datetime.now()
#     rq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/jtjy/yjfx_hlyc_json.jsp?rq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["res"]
#     res = f"井筒积液预警如下："
#     res = res + "|井号|水气比|产气量|油压|压差|合理压差|油管内径|结果|\n"
#     res = res + "|---" * 8 + "|\n"
#     i = 0
#     for x in data:
#         if i == 100:
#             break
#         if x[-1] == "积液":
#             res = res + "|" + "|".join(x) + "|\n"
#             i += 1
#     return {
#         "result": res,
#     }

# import requests
# def main(cookie: str,jh: str):
#     if "," in jh:
#         jh = jh.split(",")
#         print(jh)
#         jh = jh[0]
#     url = f"http://10.84.4.74/yyqer/dtyczd/cqgcfx/ljxyll_json.jsp?jh={jh}&H=2412.5&currcl=1.0944&curryl=0.1&t0=25.0&wj=73.0&bh=5.51&tpc=191.02&ppc=4.6&rg=0.5637&tk=308.15&hk=&tg=139.7,10.54&yg=88.9,6.54&sqb=0.5"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["v"]
#     zdv = response.json()["zdv"]
#
#     res = f"{jh}的临界携液流量如下："
#     res = res + "|李闽模型临界携液流量(10⁴m³)|Turner模型临界携液流量(10⁴m³)|振荡模型临界携液流量(10⁴m³)|连续排液产量(10⁴m³)|管柱冲蚀流量(10⁴m³)|\n"
#     res = res + "|---" * 5 + "|\n"
#     i = 0
#     for x in data:
#         res = res + "|" + str(x[0]) + "|" + str(x[3]) + "|" + str(zdv[i]) + "|" + str(x[1]) + "|" + str(x[2]) + "|\n"
#         i += 1
#     return {
#         "result": res[:3000],
#     }

# import requests
# from datetime import datetime
# def main(cookie: str):
#     nowDate = datetime.now()
#     rq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/dtyczd/scycyj/fjxjlgj_json.jsp?rq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["data"]
#
#     res = f"低压预警如下："
#     res = res + "|井号|日产气量|日产水量|油压|套压|油套压差|前日油套压差|生产压力|输压|生产压力输压差|累水气比|水气比|累产气|携液流量|预警|\n"
#     res = res + "|---" * 16 + "|\n"
#     i = 0
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/kfdtgl/jkj/jkj_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["gjjhs1"]
#     res = f"间开井开井提示如下："
#     res = res + "|井号|本次关井原因|本次关井时间|气井分类|套压|油压|油套压差|日产气(近一个月)|日产水(近一个月)|水气比(近一个月)|上一间开制度|上上间开制度|日产气|日产水|油套压差|开井方式|是否需要调整|\n"
#     res = res + "|---" * 17 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#
#     data = response.json()["kjjhs1"]
#     res = res + f"间开井关井提示如下："
#     res = res + "|井号|日产气(小时)|日度产量波动%|小时产量波动%|气井分类|套压|油压|油套压差|日产气(近一个月)|日产水(近一个月)|水气比(近一个月)|上一间开制度|上上间开制度|日产气|日产水|油套压差|对策|是否需要调整|\n"
#     res = res + "|---" * 18 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:3000],
#     }

# import requests
# from datetime import datetime
# def main(cookie: str):
#     nowDate = datetime.now()
#     rq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/kfdtgl/jkj/clyctsdj_json.jsp?rq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res33"]
#     res = f"产量异常提示如下："
#     res = res + "|井号|生产时间h|套压MPa|油压MPa|输压MPa|产气量10⁴m³|水量m³|压力基数|产量基数|压力变化|产量变化|备注|\n"
#     res = res + "|---" * 12 + "|\n"
#     i = 0
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/kfdtgl/clgl/xsjjyyj_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = f"小时级积液预警如下："
#     res = res + "|井号|管理区|前2小时油压|前2小时套压|前2小时产气量|前1小时油压|前1小时套压|前1小时产气量|当前油压|当前套压|当前产气量|\n"
#     res = res + "|---" * 11 + "|\n"
#     i = 0
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# from datetime import datetime
# import requests
# def main(cookie: str):
#     nowDate = datetime.now()
#     rq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/scbb/djsx_json.jsp?rq={rq}&tz="
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["res"]
#     res = f"单井调产管理数据如下："
#     res = res + "|井号|开采方式|生产时间h|套压MPa|油压MPa|输压MPa|当前井口气日产量m³|合理配产m³|最大配产m³|提产能力m³|备注|出砂量|\n"
#     res = res + "|---" * 12 + "|\n"
#     i = 0
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:3000],
#     }

# import requests
# from datetime import datetime,timedelta
# def main(cookie: str):
#     nowDate = datetime.now()
#     preDate = nowDate - timedelta(days=30)
#     srq = preDate.strftime("%Y-%m-%d")
#     erq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/scbb/zb_tjl_json.jsp?glq=全部&srq={srq}&erq={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["res"]
#     res = f"躺井管理数据如下："
#     res = res + "|井号|日均套压MPa|日均油压MPa|日均产气量m³|日均产水量m³|区间气累产量10⁴m³|区间水累产量m³|采气指标区间水气比|采气指标区间生产时率%|最大连续关井天数|状况|\n"
#     res = res + "|---" * 11 + "|\n"
#     for x in data:
#         if x[-1] == "躺井":
#             res = res + "|" + x[0] + "|" + "|".join(x[4:]) + "|\n"
#     return {
#         "result": res[:3000],
#     }

# import requests
# from datetime import datetime
# def main(cookie: str):
#     nowDate = datetime.now()
#     rq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/scbb/tjgl_json.jsp?rq={rq}&dbv=5&tz="
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["data"]
#     res = f"关停井影响产量分析如下："
#     res = res + "|井号|最近连续关井天数|影响产量10⁴m³|备注|\n"
#     res = res + "|---" * 4 + "|\n"
#     for x in data:
#         s = x[4].split("\'")
#         s = s[1]
#         res = res + "|" + s + "|" + x[9] + "|"+ x[10] + "|"+ x[12] + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime
# def main(cookie: str,jh: str):
#     nowDate = datetime.now()
#     rq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/qcgc/clpj/r_bynl_json.jsp?tz=&jhs={jh}&rq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#
#     res = f"{jh}的气井分类如下："
#     res = res + "|井号|生产时间h|套压MPa|油压MPa|井口气日产量	m³|放空气日产量m³|水日产量	m³|投产日期|生产时率%|气井分类|气井分类2|备注|\n"
#     res = res + "|---" * 12 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[1:13]) + "|\n"
#     return {
#         "result": res[:3000],
#     }

# import requests
# from datetime import datetime
# def main(cookie: str):
#     nowDate = datetime.now()
#     ny = nowDate.strftime("%Y%m")
#     url = f"http://10.84.4.74/yyqer/cqgc/cszb/zb_kjl_json.jsp?ny={ny}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data1 = response.json()["res"]
#     data2 = response.json()["res1"]
#
#     res = f"{ny}的生产时率如下："
#     res = res + "|区块|生产时率|\n"
#     res = res + "|---" * 2 + "|\n"
#     for x in data1:
#         res = res + "|" + x[0] + "|" + x[5] + "|\n"
#     for x in data2:
#         res = res + "|" + x[0] + "|" + x[5] + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime
# def main(cookie: str):
#     nowDate = datetime.now()
#     rq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/kfdtgl/clgl/clbdyc_json.jsp?rq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#
#     res = f"产量波动异常如下："
#     res = res + "|井号|集气站|管理区|生产压力Mpa|日产气10⁴m³|\n"
#     res = res + "|---" * 5 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:3000],
#     }

# import requests
# from datetime import datetime
# def main(cookie: str):
#     nowDate = datetime.now()
#     rq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/kfdtgl/clgl/zdjbb_json.jsp?tz=&rq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#
#     res = f"重点井报表如下："
#     res = res + "|类型|井号|套压Mpa|油压Mpa|井口气日产量m³|放空气日产量m³|水日产量m³|油日产量t|油日产量m³|\n"
#     res = res + "|---" * 9 + "|\n"
#     for x in data:
#         if x[0] == None:
#             continue
#         if "重点" in x[0]:
#             s = x[4].split("\'")
#             s = s[1]
#             res = res + "|" + x[0] + "|" + s + "|" + "|".join(x[8:15]) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime
# def main(cookie: str):
#     nowDate = datetime.now()
#     rq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/cqgc/dhc/cstj_json.jsp?srq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data1 = response.json()["res"]
#     res = f"今日措施动态数据(不含复兴)如下："
#     res = res + "|措施|井数(口)|\n"
#     res = res + "|---" * 2 + "|\n"
#     for x in data1:
#         res = res + "|" + "|".join(x) + "|\n"
#
#     data2 = response.json()["res1"]
#     res = res + f"今日措施动态数据(复兴)如下："
#     res = res + "|措施|井数(口)|\n"
#     res = res + "|---" * 2 + "|\n"
#     for x in data2:
#         res = res + "|" + "|".join(x) + "|\n"
#
#     data3 = response.json()["res2"]
#     res = res + f"今日药剂用量动态数据如下："
#     res = res + "|药剂|井数(口)|药剂用量|\n"
#     res = res + "|---" * 3 + "|\n"
#     for x in data3:
#         res = res + "|" + "|".join(x) + "|\n"
#
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime
# def main(cookie: str):
#     nowDate = datetime.now()
#     rq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/scbb/csyb/ppjrdhz_json.jsp?rq=2025-04-20"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["rs"]
#
#     res = f"泡排井跟踪数据如下："
#     res = res + "|井号|起泡剂Kg|消泡剂Kg|起泡剂配液浓度%|起泡剂加注时间h|起泡排量L/h|\n"
#     res = res + "|---" * 6 + "|\n"
#     for x in data:
#         res = res + "|" + x[3] + "|" + "|".join(x[11:-1]) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime,timedelta
# def main(cookie: str,):
#     nowDate = datetime.now()
#     preDate = nowDate - timedelta(days=90)
#     erq = nowDate.strftime("%Y-%m-%d")
#     srq = preDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/cqgygl/csgl/xhqj_ptzl_json.jsp?srq={srq}&erq={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#
#     res = f"循环气举井跟踪数据如下："
#     res = res + "|集气站|循环气举井产气量(m³/d)|循环气举井产水量(m/d)|循环气举井数|平台总气量(m³/d)|平台总水量(m³/d)|平台总井数|注入气量(m³/d)|产出：注入|气举时长(h)|助推时长(h)|助推水量(m³)|放空时长(h)|放空气量(m³)|放空水量(m³)|是否在运行|\n"
#     res = res + "|---" * 16 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime,timedelta
# def main(cookie: str):
#     nowDate = datetime.now()
#     preDate = nowDate - timedelta(days=90)
#     erq = nowDate.strftime("%Y-%m-%d")
#     srq = preDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/cqgc/qj/cngqj_json.jsp?srq={srq}&erq={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["resrcq"]
#
#     res = f"CNG气举日度跟踪数据如下："
#     res = res + "|井号|气举作业单日注气量|日期|\n"
#     res = res + "|---" * 3 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }

# import requests
# def main(cookie: str,jh: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/jczl/wjgz_tj_ygwj4_json.jsp?ffilter=a.JH&filter={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["rs5"]
#
#     res = f"{jh}的油管完井管柱数据如下："
#     res = res + "|井号|油管内径(mm)|油管外径(mm)|油管壁厚(mm)|油管钢级|油管扣型|完井管柱结构|完井管柱下入深度(m)|完井管柱底部位置(井斜角)|开工日期|完工日期|施工周期(d)|施工单位|油管生产厂家|下管作业方式|投产日期|投产与下油管间隔天数|下管前一天套压|下管前一天日产气量(方)|备注|\n"
#     res = res + "|---" * 20 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:3000],
#     }

# import requests
# from datetime import datetime,timedelta
# def main(cookie: str):
#     nowDate = datetime.now()
#     preDate = nowDate - timedelta(days=90)
#     erq = nowDate.strftime("%Y-%m-%d")
#     srq = preDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/cqgc/cszy/jqgx_jgzy_json.jsp?srq={srq}&erq={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     sortData = sorted(data,key=lambda x:x[1],reverse=True)
#     res = f"检管数据如下："
#     res = res + "|井号|检管时间|压井液量(方)|检管后日均产气(方)|检管后日均产水(方)|检管后累产气(方)|检管后累产水(方)|区间产气(方)|区间产水(方)|\n"
#     res = res + "|---" * 9 + "|\n"
#     for x in sortData:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:3000],
#     }

# import requests
# from datetime import datetime,timedelta
# def main(cookie: str,jh: str):
#     nowDate = datetime.now()
#     preDate = nowDate - timedelta(days=90)
#     erq = nowDate.strftime("%Y-%m-%d")
#     srq = preDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/cqgc/cszy/cq_zsqj_json.jsp?jhs={jh}&rq={erq}&rq1={srq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["list"][0]
#
#     res = f"{jh}的气举统计如下："
#     res = res + "|井号|区块|管理区|施工开始时间|施工结束时间|气举天数|措施开始时间|措施截止时间|AB靶点垂深差|平均水气比|气举前油压|气举前套压|措施有效天数|措施前一周日均产气(万方)|措施后一周日均产气(万方)|措施前一周生产时率(%)|措施后一周生产时率(%)|措施阶段累产气(万方)|\n"
#     res = res + "|---" * 18 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }

# import requests
# from datetime import datetime
# def main(cookie: str):
#     nowDate = datetime.now()
#     rq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/cqgc/cszy/cq_zs_json.jsp?rq={rq}&cslx=泡排"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["list"][0]
#     sortData = sorted(data, key=lambda x: x[3], reverse=True)
#     res = f"泡排统计如下："
#     res = res + "|井号|区块|管理区|措施开始时间|措施截止时间|AB靶点垂深差|平均水气比|是否运行|停运原因|当日产气量(方)|前一日产气量(方)|产量对比(方)|月生产时率(%)|措施有效天数|措施前日均产气(万方)|措施后日均产气(万方)|措施前平均生产时率(%)|措施后平均生产时率(%)|措施前平均油套压差(MPa)|措施后平均油套压差(MPa)|措施阶段平均日产气(万方)|措施阶段累产气(万方)|措施阶段增产气量(万方)|\n"
#     res = res + "|---" * 23 + "|\n"
#     for x in sortData:
#         res = res + "|" + "|".join(x[:-1]) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime
# def main(cookie: str):
#     nowDate = datetime.now()
#     rq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/cqgc/cszy/cq_zs_json.jsp?rq={rq}&cslx=柱塞"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["list"][0]
#     sortData = sorted(data, key=lambda x: x[3], reverse=True)
#     res = f"柱塞统计如下："
#     res = res + "|井号|区块|管理区|措施开始时间|措施截止时间|AB靶点垂深差|平均水气比|卡定器下深m|开关井制度|油管尺寸|当日产气量(方)|前一日产气量(方)|产量对比(方)|月生产时率(%)|措施有效天数|措施前日均产气(万方)|措施后日均产气(万方)|措施前平均生产时率(%)|措施后平均生产时率(%)|措施前平均油套压差(MPa)|措施后平均油套压差(MPa)|措施阶段平均日产气(万方)|措施阶段累产气(万方)|措施阶段增产气量(万方)|\n"
#     res = res + "|---" * 24 + "|\n"
#     for x in sortData:
#         res = res + "|" + "|".join(x[:-1]) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime
# def main(cookie: str):
#     nowDate = datetime.now()
#     rq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/cqgc/cszy/cq_zs_json.jsp?rq={rq}&cslx=智能间开"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["list"][0]
#     sortData = sorted(data, key=lambda x: x[3], reverse=True)
#     res = f"智能间开统计如下："
#     res = res + "|井号|区块|管理区|措施开始时间|措施截止时间|AB靶点垂深差|平均水气比|-|当日产气量(方)|前一日产气量(方)|产量对比(方)|月生产时率(%)|措施有效天数|措施前日均产气(万方)|措施后日均产气(万方)|措施前平均生产时率(%)|措施后平均生产时率(%)|措施前平均油套压差(MPa)|措施后平均油套压差(MPa)|措施阶段平均日产气(万方)|措施阶段累产气(万方)|措施阶段增产气量(万方)|\n"
#     res = res + "|---" * 22 + "|\n"
#     for x in sortData:
#         res = res + "|" + "|".join(x[:-1]) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime
# def main(cookie: str):
#     nowDate = datetime.now()
#     rq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/cqgc/cszy/cq_zs_json.jsp?rq={rq}&cslx=管网气气举"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["list"][0]
#     sortData = sorted(data, key=lambda x: x[3], reverse=True)
#     res = f"管网气气举统计如下："
#     res = res + "|井号|区块|管理区|措施开始时间|措施截止时间|AB靶点垂深差|平均水气比|-|当日产气量(方)|前一日产气量(方)|产量对比(方)|月生产时率(%)|措施有效天数|措施前日均产气(万方)|措施后日均产气(万方)|措施前平均生产时率(%)|措施后平均生产时率(%)|措施前平均油套压差(MPa)|措施后平均油套压差(MPa)|措施阶段平均日产气(万方)|措施阶段累产气(万方)|措施阶段增产气量(万方)|\n"
#     res = res + "|---" * 22 + "|\n"
#     for x in sortData:
#         res = res + "|" + "|".join(x[:-1]) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime
# def main(cookie: str):
#     nowDate = datetime.now()
#     rq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/cqgc/cszy/cq_zs_json.jsp?rq={rq}&cslx=电潜泵"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["list"][0]
#     sortData = sorted(data, key=lambda x: x[3], reverse=True)
#     res = f"电潜泵统计如下："
#     res = res + "|井号|区块|管理区|措施开始时间|措施截止时间|AB靶点垂深差|平均水气比|-|当日产气量(方)|前一日产气量(方)|产量对比(方)|月生产时率(%)|措施有效天数|措施前日均产气(万方)|措施后日均产气(万方)|措施前平均生产时率(%)|措施后平均生产时率(%)|措施前平均油套压差(MPa)|措施后平均油套压差(MPa)|措施阶段平均日产气(万方)|措施阶段累产气(万方)|措施阶段增产气量(万方)|\n"
#     res = res + "|---" * 22 + "|\n"
#     for x in sortData:
#         res = res + "|" + "|".join(x[:-1]) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime
# def main(cookie: str):
#     nowDate = datetime.now()
#     rq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/cqgc/cszy/cq_zs_json.jsp?rq={rq}&cslx=射流泵"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["list"][0]
#     sortData = sorted(data, key=lambda x: x[3], reverse=True)
#     res = f"截止{rq}的射流泵统计如下："
#     res = res + "|井号|区块|管理区|措施开始时间|措施截止时间|AB靶点垂深差|日均注水量|平均泵压|平均水气比|当日产气量(方)|前一日产气量(方)|产量对比(方)|月生产时率(%)|措施有效天数|措施前日均产气(万方)|措施后日均产气(万方)|措施前平均生产时率(%)|措施后平均生产时率(%)|措施前平均油套压差(MPa)|措施后平均油套压差(MPa)|措施阶段平均日产气(万方)|措施阶段累产气(万方)|措施阶段增产气量(万方)|\n"
#     res = res + "|---" * 23 + "|\n"
#     for x in sortData:
#         res = res + "|" + "|".join(x[:-1]) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime,timedelta
# def main(cookie: str):
#     nowDate = datetime.now()
#     preDate = nowDate - timedelta(days=90)
#     erq = nowDate.strftime("%Y-%m-%d")
#     srq = preDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/cqgc/cszy/zb_zcxcs9_json.jsp?srq1={srq}&erq1={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["listA"]
#     sortData = sorted(data, key=lambda x: x[2], reverse=True)
#     res = f"抽油机统计如下："
#     res = res + "|措施类型|井号|开始时间|截止时间|折算措施费用(万元)|措施期(天)|累计产气(万方)|累计产水(方)|日均产气(万方)|日均产水(方)|生产小时(小时)|总耗电量|电流|冲程|冲次|措施有效率|措施回收期(天)|\n"
#     res = res + "|---" * 17 + "|\n"
#     for x in sortData:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime,timedelta
# def main(cookie: str):
#     nowDate = datetime.now()
#     preDate = nowDate - timedelta(days=90)
#     erq = nowDate.strftime("%Y-%m-%d")
#     srq = preDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/cqgc/cstj/xhqj_json.jsp?srq={srq}&erq={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     sortData = sorted(data, key=lambda x: x[5], reverse=True)
#     res = f"循环气举统计如下："
#     res = res + "|井号|区块|管理区|措施开始时间|措施截止时间|该阶段是否循环气举|区间产气量(万方)|区间产水量(方)|区间生产时率(%)|区间平均油套压差(MPa)|\n"
#     res = res + "|---" * 10 + "|\n"
#     for x in sortData:
#         res = res + "|" + "|".join(x[2:-1]) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime,timedelta
# def main(cookie: str):
#     nowDate = datetime.now()
#     ny = nowDate.strftime("%Y%m")
#     url = f"http://10.84.4.74/yyqer/cqgygl/csgl/ppjyzdtz_json.jsp?ny={ny}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = f"加注制度如下："
#     res = res + "|井号|加注类型|共用流程|起泡剂配液浓度|起泡剂起泡排量|起泡剂理论加药量|消泡剂配液浓度|消泡剂起泡排量|消泡剂理论加药量|备注|制度调整情况|\n"
#     res = res + "|---" * 11 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[3:-1]) + "|\n"
#
#     return {
#         "result": res[:3000],
#     }

# import requests
# from datetime import datetime
# def main(cookie: str):
#     nowDate = datetime.now()
#     ny = nowDate.strftime("%Y%m")
#     url = f"http://10.84.4.74/yyqer/cqgygl/csgl/yjkctz_list.jsp?whereCause1={ny}&whereCause2={ny}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["data"]
#     sortData = sorted(data, key=lambda x: x["SCRQ"], reverse=True)
#     res = f"药剂库存台账如下："
#     res = res + "|井站|上传日期|起泡剂库存(桶)|消泡剂库存(桶)|缓蚀杀菌剂库存(桶)|起泡剂厂家|消泡剂厂家|缓蚀杀菌剂厂家|经办人|\n"
#     res = res + "|---" * 9 + "|\n"
#     for x in sortData:
#         res = res + "|" + x["JZ"] + "|" + x["SCRQ"] + "|" + x["QPJKC"] + "|" + x["XPJKC"] + "|" + x["HSSJJ"] + "|" + x["QPJCJ"] + "|" + x["XPJCJ"] + "|" + x["HSSJJCJ"] + "|" + x["JBR"] + "|\n"
#
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime
# def main(cookie: str):
#     nowDate = datetime.now()
#     ny = nowDate.strftime("%Y%m")
#     url = f"http://10.84.4.74/yyqer/cqgygl/csgl/yjlltz_list.jsp?whereCause1={ny}&whereCause2={ny}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["data"]
#     sortData = sorted(data, key=lambda x: x["RQ"], reverse=True)
#     res = f"集气站领料、转运台账如下："
#     res = res + "|井站|日期|领料/转运类型|药剂种类|厂家|生产时间|数量(桶)|经办人|备注|\n"
#     res = res + "|---" * 9 + "|\n"
#     for x in sortData:
#         res = res + "|" + x["JZ"] + "|" + x["RQ"] + "|" + x["LX"] + "|" + x["YJZL"] + "|" + x["CJ"] + "|" + x["SCSJ"] + "|" + x["SL"] + "|" + x["JBR"] + "|" + x["BZ"] + "|\n"
#
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime
# def main(cookie: str):
#     nowDate = datetime.now()
#     rq = nowDate.strftime("%Y")
#     url = f"http://10.84.4.74/yyqer/scbb/csyb/xqjhtz_json.jsp?rq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["rs"]
#     sortData = sorted(data, key=lambda x: x[1], reverse=True)
#     res = f"需求计划台账如下："
#     res = res + "|管理区|提报时间|需求计划名称|起泡剂计划(吨)|消泡剂计划(吨)|药剂厂家|备注|\n"
#     res = res + "|---" * 7 + "|\n"
#     for x in sortData:
#         res = res + "|" + "|".join(x) + "|\n"
#
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/cqgygl/csgl/ppsbtz_json.jsp?"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     sortData = sorted(data, key=lambda x: x[7], reverse=True)
#     res = f"泡排泵撬台账如下："
#     res = res + "|井号|投产日期|泡排投运时间|是否有加药流程|泵撬类型|加注类型|泵功率(kw)|厂家|共用流程|是否长期停运|长期停运原因|辅助工艺|\n"
#     res = res + "|---" * 12 + "|\n"
#     for x in sortData:
#         res = res + "|" + x[2] + "|" + "|".join(x[6:-1]) + "|\n"
#
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime, timedelta
# def main(cookie: str,jh: str):
#     nowDate = datetime.now()
#     preDate = nowDate - timedelta(days = 1)
#     rq = nowDate.strftime("%Y-%m-%d")
#     rq2 = preDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/scbb/csyb/xgfx_json.jsp?rq={rq}&rq2={rq2}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     #提取井号
#     jhs = jh.split(",")
#     dict = {}
#     for x in jhs:
#         dict[x]=1
#
#     data = response.json()["rs"]
#     res = f"{rq},{jh}的效果分析如下："
#     res = res + "|区块|管理区|井号|前一日套压Mpa|前一日油压Mpa|前一日油套压差Mpa|前一日气产量m³|前一日水产量m³|前一日水气比%|前一日生产时率%|当日套压Mpa|当日油压Mpa|当日油套压差Mpa|当日气产量m³|当日水产量m³|当日水气比%|当日生产时率%|套压变化Mpa|油压变化Mpa|油套压差变化Mpa|气产量变化m³|水产量变化m³|水气比变化%|生产时率变化%|\n"
#     res = res + "|---" * 26 + "|\n"
#     for x in data:
#         if x[2] in dict:
#             res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# from datetime import datetime, timedelta
# import requests
# def main(cookie: str):
#     nowDate = datetime.now()
#     ny = nowDate.strftime("%Y%m")
#     date = datetime.strptime(ny+"15","%Y%m%d")
#     preDate = date - timedelta(days=31)
#     ny2 = preDate.strftime("%Y%m%d")
#     ny2 = ny2[:-2]
#
#     url = f"http://10.84.4.74/yyqer/scbb/csyb/yjjyfx_json.jsp?rq={ny}&rq2={ny2}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["rs"]
#     res = f"药剂经营分析如下："
#     res = res + "|区块|管理区|井号|上月日均产水量(方)|理论日均起泡剂加注量(Kg)|理论日均消泡剂加注量最小值(Kg)|理论日均消泡剂加注量最大值(Kg)|理论月度起泡剂加注量(Kg)|理论月度消泡剂加注量最小值(Kg)|理论月度消泡剂加注量最大值(Kg)|实际起泡剂消耗量(Kg)|实际消泡剂消耗量(Kg)|▲起泡剂(kg)|▲消泡剂最小值(kg)|▲消泡剂最最值(kg)|\n"
#     res = res + "|---" * 15 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime
# def main(cookie: str):
#     nowDate = datetime.now()
#     rq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/dtyczd/cqscdt/cq_ycfx_json.jsp?&rq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#
#     res = f"今日异常预警如下："
#     res = res + "|井号|采气区|初步判断|排查方法|措施建议|生产方式|油管外径(mm)|油管壁厚(mm)|中部深度(m)|油管内径(mm)|油管下深(m)|B-A垂深差(m)|套压(MPa)|油压(Mpa)|日产气(方/天)|日产水(方/天)|实际油套压差(Mpa)|合理油套压差(MPa)|计算井底流压(MPa)|临界携液流量(方/天)|备注|\n"
#     res = res + "|---" * 21 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime,timedelta
# def main(cookie: str,jh: str):
#     nowDate = datetime.now()
#     preDate = nowDate - timedelta(days=10)
#     erq = nowDate.strftime("%Y-%m-%d")
#     srq = preDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/cqgygl/ycyj/ycjfx_json.jsp?&jh={jh}&srq={srq}&erq={erq}&tz="
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["data"]
#
#     res = f"{jh}的异常井分析如下："
#     res = res + "|日期|生产时间h|套压Mpa|油压Mpa|输压Mpa|温度|井口气日产量m³|放空气日产量m³|水日产量m³|油日产量t|油日产量m³|井口气月产量10⁴m³|水月产量m³|油月产量t|油月产量m³|井口气年产量10⁴m³|水年产量m³|油年产量t|油年产量m³|井口气累产量10⁴m³|工业气累产量10⁴m³|水累产量m³|油累产量t|累月产量m³|起泡剂Kg|消泡剂Kg|缓蚀杀菌剂Kg|生产自用气m³|表套|技套|流压Mpa|备注|\n"
#     res = res + "|---" * 32 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime
# def main(cookie: str):
#     nowDate = datetime.now()
#     rq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/jtjy/jtjymhpb_json.jsp?&rq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#
#     res = f"井筒积液风险判别如下："
#     res = res + "|井号|30天均日产气104m3|30天均日产水m3|30天均气水比|30天日产气变化率|30天日产水变化率|30天气水比变化率|当天油套压差(MPa)|当天油压(Mpa)|30天油套压差变化率|30天油压变化率|\n"
#     res = res + "|---" * 11 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[:-1]) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime
# def main(cookie: str,jh: str):
#     nowDate = datetime.now()
#     rq = nowDate.strftime("%y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/cqgc/scfx/r_zyyj_json.jsp?tz=&jhs={jh}&rq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#
#     res = f"{jh}的增压识别预警如下："
#     res = res + "|井号|生产时间h|套压MPa|油压MPa|输压MPa|井口气日产量m³|水日产量m³|投产日期|气井分类|增压识别|\n"
#     res = res + "|---" * 10 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[3:12]) + "|" + x[13] + "|\n"
#     return {
#         "result": res,
#     }

# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/cszb/zb_qjmxq2_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["rs5"]
#     sortData = sorted(data,key = lambda x: x[1])
#     res = f"气井免修期如下："
#     res = res + "|井号|投产日期|下油管日期|下连油日期|检管开始日|检管结束日|免修期起|免修期止|免修期(日)|免修期(月)|\n"
#     res = res + "|---" * 10 + "|\n"
#     for x in sortData:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/cszb/zb_zysgsj_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["rs5"]
#     sortData = sorted(data,key = lambda x: x[3],reverse=True)
#
#     res = f"井下作业施工时间如下："
#     res = res + "|井号|投产日期|检管开始日|检管结束日|检管时间(日)|\n"
#     res = res + "|---" * 5 + "|\n"
#     for x in sortData:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime
# def main(cookie: str,jh: str):
#     nowDate = datetime.now()
#     rq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/cqgc/scfx/r_zyyj_json.jsp?tz=&jhs={jh}&rq={rq}"
#
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["res"]
#     res = f"{jh}的增压识别预警如下："
#     res = res + "|井号|生产时间h|套压MPa|油压MPa|输压MPa|井口气日产量m³|水日产量m³|投产日期|气井分类|增压识别|\n"
#     res = res + "|---" * 10 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[3:12]) + "|" + x[13] + "|\n"
#     return {
#         "result": res[:5000],
#     }
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/cszb/zb_qjmxq2_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["rs5"]
#     sortData = sorted(data,key = lambda x: x[7],reverse = True)
#     res = f"气井免修期如下："
#     res = res + "|井号|投产日期|下油管日期|下连油日期|检管开始日|检管结束日|免修期起|免修期止|免修期(日)|免修期(月)|\n"
#     res = res + "|---" * 10 + "|\n"
#     for x in sortData:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:5000],
#     }
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/cszb/zb_zysgsj_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["rs5"]
#     sortData = sorted(data,key = lambda x: x[3],reverse=True)
#
#     res = f"井下作业施工时间如下："
#     res = res + "|井号|投产日期|检管开始日|检管结束日|检管时间(日)|\n"
#     res = res + "|---" * 5 + "|\n"
#     for x in sortData:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:5000],
#     }
# import requests
# from datetime import datetime,timedelta
# def main(cookie: str,jh: str):
#     nowDate = datetime.now()
#     preDate = nowDate - timedelta(days=1)
#     srq = preDate.strftime("%Y-%m-%d")
#     erq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/cqgc/cszb/zb_scsl_json.jsp?jh={jh}&srq1={srq}&erq1={erq}&srq2={srq}&erq2={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = f"{jh}的采气指标如下："
#     res = res + "|井号|前一日区间水气比|前一日生产时率%|今日区间水气比|今日生产时率%|\n"
#     res = res + "|---" * 5 + "|\n"
#     for x in data:
#         res = res + "|" +x[0] + "|" + x[11] + "|" + x[12] + "|" + x[19] + "|" + x[20] + "|\n"
#     return {
#         "result": res[:5000],
#     }
# import requests
# from datetime import datetime,timedelta
# def main(cookie: str):
#     nowDate = datetime.now()
#     preDate = nowDate - timedelta(days=30)
#     srq = preDate.strftime("%Y-%m-%d")
#     erq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/cqgc/cszb/zb_tjl_json.jsp?glq=全部&qkdymc=全部&jhlx=全部&srq1={srq}&srq2={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = f"水淹关停数据,所有井的躺井率为{response.json()['res6'][14]}%,下面是状态为躺井的井的最大连续关井天数：\n"
#     res = res + "|井号|最大连续关井天数|状况|\n"
#     res = res + "|---" * 3 + "|\n"
#     for x in data:
#         if x[14] == "躺井":
#             res = res + "|" +x[0] + "|" + x[13] + "|" + x[14] + "|\n"
#     return {
#         "result": res[:5000],
#     }
# import requests
# from datetime import datetime,timedelta
# def main(cookie: str):
#     nowDate = datetime.now()
#     preDate = nowDate - timedelta(days=30)
#     srq = preDate.strftime("%Y-%m-%d")
#     erq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/cqgc/cszb/tjl_new_json.jsp?glq=全部&qkdymc=全部&jhlx=全部&srq1={srq}&srq2={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = f"躺井数据如下:\n"
#     res = res + "|躺井类型|井号|区块|管理区|躺井时长(h)|\n"
#     res = res + "|---" * 5 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:5000],
#     }
# import requests
# from datetime import datetime,timedelta
# def main(cookie: str):
#     nowDate = datetime.now()
#     preDate = nowDate - timedelta(days=90)
#     srq = preDate.strftime("%Y-%m-%d")
#     erq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/cqgygl/cqgy/cstj_fqtj_json.jsp?glqqkyd=全部&qkdymc=全部&srqk1={srq}&erqk1={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = f"措施统计如下:\n"
#     res = res + "|措施类型|实施井数|实施井次|百万方产气量措施成本|\n"
#     res = res + "|---" * 4 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:5000],
#     }
# import requests
# from datetime import datetime,timedelta
# def main(cookie: str):
#     nowDate = datetime.now()
#     preDate = nowDate - timedelta(days=90)
#     srq = preDate.strftime("%Y-%m-%d")
#     erq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/cqgygl/bbsc/fqgyhzb_json.jsp?srqk1={srq}&erqk1={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = f"工艺汇总表如下:\n"
#     res = res + "|类型|项目|焦石坝|江东|平桥|白马|复兴|红星|建南|合计|\n"
#     res = res + "|---" * 10 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:5000],
#     }
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/djfx/table_list.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"油管穿孔数据如下:\n"
#     res = res + "|井号|油管外径(mm)|油管壁厚(mm)|下管日期|油管厂家|检管日期|穿孔油管根数|穿孔点数量|腐蚀状况|检管间隔天数|\n"
#     res = res + "|---" * 10 + "|\n"
#     for x in data:
#         res = res + "|" + x["JH"] + "|" + x["YGWJ"] + "|" + x["YGBH"] + "|" + x["XGRQ"] + "|" + x["YGCJ"] + "|" + x["JGRQ"] + "|" + x["CKYGGS"] + "|" + x["CKDSL"] + "|" + x["FSZK"] + "|" + x["JGJGTS"] +  "|\n"
#     return {
#         "result": res[:5000],
#     }
# import requests
# from datetime import datetime,timedelta
# def main(cookie: str):
#     nowDate = datetime.now()
#     preDate = nowDate - timedelta(days=3650)
#     srq = preDate.strftime("%Y-%m-%d")
#     erq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/cqgc/scfx/gx_ygts_json.jsp?srq={srq}&erq={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["rs"]
#     sortDate = sorted(data,key = lambda x:x[0],reverse=True)
#     res = f"油管探伤数据如下:\n"
#     res = res + "|日期|井号|油管数据|油管尺寸|合格数|不合格数|合格率(%)|检测人|备注|\n"
#     res = res + "|---" * 9 + "|\n"
#     for x in sortDate:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:5000],
#     }
# import requests
# from datetime import datetime
# def main(cookie: str):
#     nowDate = datetime.now()
#     nd = nowDate.strftime("%Y")
#     url = f"http://10.84.4.74/yyqer/cqgc/lj/ljzhzl_cljs_json.jsp?nd={nd}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     sortDate = sorted(data,key = lambda x:x[2],reverse=True)
#     res = f"老井产量基数数据如下:\n"
#     res = res + "|井号|投产时间|生产阶段|1月|2月|3月|4月|5月|6月|7月|8月|9月|10月|11月|12月|\n"
#     res = res + "|---" * 15 + "|\n"
#     for x in sortDate:
#         res = res + "|" + x[0] + "|" + "|".join(x[1:]) + "|\n"
#     return {
#         "result": res[:5000],
#     }
# import requests
# from datetime import datetime,timedelta
# def main(cookie: str):
#     nowDate = datetime.now()
#     preDate = nowDate - timedelta(days=105)
#     syf = preDate.strftime("%Y%m")
#     eyf = nowDate.strftime("%Y%m")
#     url = f"http://10.84.4.74/yyqer/cqgc/lj/cszlhz_new_json.jsp?yf={syf}&yf2={eyf}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = f"措施增量汇总如下:\n"
#     res = res + "|措施类型|年计划实施井次|实际实施井次|年计划增气量(万方)|年实际增气量(万方)|\n"
#     res = res + "|---" * 5 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:5000],
#     }
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/dxj/dxj_scxg_json.jsp?jhs={jh}&fanw=qbj&sort=a.jh"
#     response = requests.post(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = f"{jh}的低效治理效果如下:\n"
#     res = res + "|井号|全年基数10⁴m³|全年措施计划10⁴m³|全年实际产量10⁴m³|全年计划增量10⁴m³|全年实际增量10⁴m³|\n"
#     res = res + "|---" * 6 + "|\n"
#     for x in data:
#         res = res + "|" + x[0] + "|" + "|".join(x[-5:]) + "|\n"
#     return {
#         "result": res[:5000],
#     }
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/jczl/sb_cqs_json.jsp"
#     response = requests.post(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     sortData = sorted(data, key = lambda x: x[5],reverse=True)
#     res = f"地面集气设备（采气树）统计表如下:\n"
#     res = res + "|井号|生产厂家|材料级别|型号|生产编号|安装日期|\n"
#     res = res + "|---" * 6 + "|\n"
#     for x in sortData:
#         res = res + "|" + "|".join(x[:-1]) + "|\n"
#     return {
#         "result": res[:5000],
#     }
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/jczl/jxyg_json.jsp?jh={jh}"
#     response = requests.post(url, headers={"cookie": cookie})
#
#     data = response.json()["rs5"]
#     res = f"{jh}的井下油管数据如下(只能查询单井的数据):\n"
#     res = res + "|管柱编号|管串名称|内径(mm)|外径(mm)|壁厚(mm)|钢级|扣型|长度(m)|下深(m)|厂家	备注|\n"
#     res = res + "|---" * 10 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/cqgc/jczl/gx_lrf_json.jsp"
#     response = requests.post(url, headers={"cookie": cookie})
#
#     data = response.json()["rs"]
#     res = f"联络阀数据如下:\n"
#     res = res + "|联络阀名称|联络阀位置|联络管线|开关情况|\n"
#     res = res + "|---" * 4 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/jtbb/gjjssj_json.jsp?jh={jh}"
#     response = requests.post(url, headers={"cookie": cookie})
#
#     data = response.json()["res"]
#     res = f"{jh}的固井质量数据(只能查询单井的数据)如下:\n"
#     res = res + "|解释序号|顶深(m)|底深(m)|一界面解释结论|二界面解释结论|解释单位|备注|\n"
#     res = res + "|---" * 7 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/jtbb/tgjg_json.jsp?jh={jh}"
#     response = requests.post(url, headers={"cookie": cookie})
#
#     data = response.json()["rs5"]
#     res = f"{jh}的接箍数据(只能查询单井的数据)如下:\n"
#     res = res + "|油层套管序号|单根长(m)|套管接箍深度(m)|备注|\n"
#     res = res + "|---" * 4 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# def main() -> dict:
#     res = ""
#     for i in range(0,150000):
#         res += "i"
#     return {
#         "result": res
#     }
# import requests
# def main(cookie)->str:
#     url = "http://10.84.4.74/yyqer/dhc/scdt_table_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()
#     res = "每日生产动态信息如下:\n"
#     res = res + "|截至今日|江汉油田|涪陵公司|采气一厂|\n" + "|---|---|---|---|\n"
#     for x in data["data"]:
#         res = res + f"|{x[0]}|{x[1] if x[1] else 0}|{x[2] if x[2] else 0}|{x[2] if x[2] else 0}|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/gcbb/yx_zjgc_json.jsp"
#     response = requests.post(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"钻井概况如下:\n"
#     res = res + "|钻井队|井号|设计|实钻|钻达层位|当日|月累计|年累计|下部工序|钻机动态|工程简述|\n"
#     res = res + "|---" * 11 + "|\n"
#     i = 0
#     for x in data:
#         if i == 20:
#             break
#         res = res + "|" + "|".join(x[:6]) + "|" + "|".join(x[17:20]) + "|" + x[21] + "|" + x[22] + "|" + x[20] + "|\n"
#         i += 1
#     url = f"http://10.84.4.74/yyqer/dzdx/reader/dxj_json.jsp"
#     response = requests.post(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     titles = response.json()["titles"]
#     res = res + "钻井概况中的导向井如下：\n"
#     res = res + "|" + "|".join(titles) + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/dzdx/sjgl/dxjgl_list.jsp"
#     response = requests.post(url, headers={"cookie": cookie})
#     print(response.json())
#     data = response.json()["data"]
#     res = f"导向管理数据如下:\n"
#     res = res + "|井号|导向参照井|模型名称|导向人员|指派人员|增加人员|实时数据源|负责人|定向仪器类型|目的层|\n"
#     res = res + "|---" * 2 + "|\n"
#     for x in data:
#         res = res + "|" + "|".join(x[:2]) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie):
#     url = "http://10.84.4.74/yyqer/dhc/jqzsycsyt_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()
#     res = "目前江汉油田存在的管输异常如下：\n"
#     body = ""
#     for x in data["data"]:
#         if x[0] and int(x[0]) > 0.5:
#             body = body + f"起点站：{x[1]}，末点站：{x[2]}，压差(MPa)：{x[0]};"
#     if body == "":
#         return {
#         "result": "目前江汉油田没有的管输异常数据\n",
#     }
#     res = res +body
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie):
#     url = "http://10.84.4.74/yyqer/dhc/gzyc_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()
#     res = "目前江汉油田存在采气异常井和异常状态分别是："
#     body = ""
#     for x in data["data"]:
#         body = body + f"{x[0]}为{x[1]}，"
#     if body == "":
#         return {
#             "result": "目前江汉油田没有采气异常井和异常状态的数据\n",
#         }
#     res = res +body
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie):
#     url = "http://10.84.4.74/yyqer/jsgl/reader/gx_fsckdy_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()
#     res = "目前江汉油田存在的集气站异常如下："
#     body = ""
#     for x in data["data"]:
#         body = body + f"{x[0]}近一月穿孔次数已达{x[1]}次，待治理;"
#     if body == "":
#         return {
#             "result": "目前江汉油田没有集气站异常的数据\n",
#         }
#     res = res +body
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie):
#     url = "http://10.84.4.74/yyqer/dhc/scdt_table_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()
#     res = "每日生产动态信息如下:\n"
#     res = res + "|截至今日|江汉油田|涪陵公司|采气一厂|\n" + "|---|---|---|---|\n"
#     body = ""
#     for x in data["data"]:
#         body = body + f"|{x[0]}|{x[1] if x[1] else 0}|{x[2] if x[2] else 0}|{x[2] if x[2] else 0}|\n"
#     if body == "":
#         return {
#             "result": "目前没有每日生产动态信息数据\n"
#         }
#     res = res +body
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie):
#     url = "http://10.84.4.74/yyqer/dhc/fyjhdb_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()
#     res = "目前江汉油田产气量和销量计划(产建信息)是：\n"
#     res = res + "|月份|计划气量|实际产量|计划销售|实际销售|\n" + "|---|---|---|---|---|\n"
#     body = ""
#     for x in data["data"]:
#         body = body + f"|{x[0]}|{x[2]}|{x[1]}|{x[4]}|{x[3]}|\n"
#     if body == "":
#         return {
#             "result": "目前没有江汉油田产气量和销量计划（产建信息）数据\n"
#         }
#     res = res +body
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie, jh):
#     url = f"http://10.84.4.74/yyqer/gcbb/yx_zjgc_dj_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"][0]
#     res = f"{jh}的钻井日报如下：\n"
#     res = res + "|日期|施工单位|钻井队|井号|设计井深|实际井深|目的层|钻达层位|钻头尺寸|钻井液类别|各次开钻时间|钻压KN|钻速r/min|排量l/s|泵压Mpa|密度g/cm3|粘度pa.s|当日进尺m|月度进尺m|年累进尺m|工况简介|下一步工序|\n"
#     res = res + "|---" * 22 + "|\n"
#     if data == "":
#         return {
#             "result": f"没有{jh}的钻井日报数据\n",
#         }
#     res = res + "|" + "|".join(data) + "|"
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie, jh):
#     url = f"http://10.84.4.74/yyqer/gcbb/yx_sqgc_dj_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"][0]
#     res = "{jh}的试气日报如下：\n"
#     res = res + "|日期|试气单位|队号|井号|层位|设孔井段m|厚度m|层（段）数|开工时间|措施类型/工艺|施工简况|下一步工序|\n"
#     res = res + "|---" * 12 + "|\n"
#     if data == "":
#         return {
#             "result": f"没有{jh}的试气日报数据\n",
#         }
#     res = res + "|" + "|".join(data) + "|"
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime
# def main(cookie, jh):
#     date_now = datetime.now().strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/scbb/r_rdbb_json.jsp?tz=&jhs={jh}&rq={date_now}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"][0]
#     res = "生产日报如下：\n"
#     res = res + "|公司|区块|管理区|井号|中心站|井站|层位|生产井段m|开采方式|生产时间|套压Mpa|油压Mpa|井口气吗m3/日|放空气m3/日|水m3/日|油t/日|油m3/日|起泡剂kg|消泡剂kg|缓蚀杀菌剂kg|输压Mpa|温度|生产自用气m3|表套Mpa|技套Mpa|孔板mm|氯根mg|油嘴mm|投产日期|备注|\n"
#     res = res + "|---" * 30 + "|\n"
#     if data == "":
#         return {
#             "result": f"没有{jh}的生产日报数据\n",
#         }
#     res = res + "|" + "|".join(data) + "|"
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime
# def main(cookie, jh):
#     date_now = datetime.now().strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/scbb/r_rdbb_json.jsp?tz=&jhs={jh}&rq={date_now}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"][0][1]
#     url = f"http://10.84.4.74/yyqer/scbb/r_qkrb_json.jsp?qk={data}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"][-1]
#     res = f"{jh}的区块日报如下：\n"
#     res = res + "|日期|气田|区块|总井数|开井数|生产压力|套压MPa|油压MPa|输压MPa|日产量井口气/10000m3|日产量工业气/10000m3|日产水m3|月产量井口气/10000m3|月产量工业气/10000m3|月产水m3|年产量井口气/10000m3|年产量工业气/10000m3|年产水m3|累产量井口气/10000m3|累产量工业气/10000m3|累产水m3|生产自用气m3|\n"
#     res = res + "|---" * 22 + "|\n"
#     if data == "":
#         return {
#             "result": f"没有{jh}的区块日报数据\n",
#         }
#     res = res + "|" + "|".join(data) + "|"
#     return {
#         "result": res[:3000],
#     }


# import re
# def main(arg1: str):
#     matches = re.findall(r'\{([^{}]*)\}', arg1)
#     return {
#         "result": str(matches[0]),
#     }
# res = main("[以下是计算过程：焦页62-5HF井从1.4万方能提产到9万方;焦页64-4HF井从0.1万方能提产到7.5万方;焦页27-S9HF井从2.8万方能提产到9.4万方]{本次提产20万方的建议为：稳产井：焦页62-5HF井从1.4万方能提产到9万方；间开井：焦页64-4HF井从0.1万方能提产到7.5万方；增压潜力井：焦页27-S9HF井从2.8万方能提产到9.4万方}")
# print(res)
# print(len(res["result"]))

# import requests
# def main(cookie, jh):
#     url = f"http://10.84.4.74/yyqer/gcbb/yx_zjgc_dj_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"][0]
#     res = f"{jh}的钻井日报如下：\n"
#     res = res + "|日期|施工单位|钻井队|井号|设计井深|实际井深|目的层|钻达层位|钻头尺寸|钻井液类别|各次开钻时间|钻压KN|钻速r/min|排量l/s|泵压Mpa|泥浆密度g/cm3|泥浆粘度pa.s|当日进尺m|月度进尺m|年累进尺m|工况简述|下一步工序|\n"
#     res = res + "|---" * 22 + "|\n"
#     if data == "":
#         return {
#             "result": f"没有{jh}的钻井日报数据\n",
#         }
#     res = res + "|" + "|".join(["无" if item == "" else item for item in data]) + "|"
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie):
#     url = "http://10.84.4.74/yyqer/dhc/fyjhdb_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()
#     res = "目前江汉油田产气量和销量计划(产建信息)是：\n"
#     res = res + "|月份|计划气量|实际产量|计划销售|实际销售|\n" + "|---|---|---|---|---|\n"
#     body = ""
#     data = [
#         ["无" if item == "" else item for item in row]
#         for row in data["data"]
#     ]
#     for x in data:
#         body = body + f"|{x[0]}|{x[2]}|{x[1]}|{x[4]}|{x[3]}|\n"
#     if body == "":
#         return {
#             "result": "目前没有江汉油田产气量和销量计划（产建信息）数据\n"
#         }
#     res = res +body
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime
# def main(cookie, jh):
#     nowDate = datetime.now()
#     rq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/gcbb/yx_sqgc_dj_json.jsp?jh={jh}&rq={rq}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"][0]
#     res = f"{jh}的试气日报如下：\n"
#     res = res + "|日期|试气单位|队号|井号|层位|射孔井段m|厚度m|层（段）数|开工时间|措施类型/工艺|施工简况|下一步工序|\n"
#     res = res + "|---" * 12 + "|\n"
#     if data == "":
#         return {
#             "result": f"没有{jh}的试气日报数据\n",
#         }
#     res = res + "|" + "|".join(["无" if item == "" else item for item in data]) + "|"
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime
# def main(cookie, jh):
#     date_now = datetime.now().strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/scbb/r_rdbb_json.jsp?tz=&jhs={jh}&rq={date_now}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"][0]
#     res = f"{jh}生产日报如下：\n"
#     res = res + "|公司|区块|管理区|井号|中心站|井站|层位|生产井段m|开采方式|生产时间|套压Mpa|油压Mpa|井口气吗m3/日|放空气m3/日|水m3/日|油t/日|油m3/日|起泡剂kg|消泡剂kg|缓蚀杀菌剂kg|输压Mpa|温度|生产自用气m3|表套Mpa|技套Mpa|孔板mm|氯根mg|油嘴mm|投产日期|备注|\n"
#     res = res + "|---" * 30 + "|\n"
#     if data == "":
#         return {
#             "result": f"没有{jh}的生产日报数据\n",
#         }
#     res = res + "|" + "|".join(["无" if item == "" else item for item in data]) + "|"
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime
# def main(cookie, jh):
#     date_now = datetime.now().strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/scbb/r_rdbb_json.jsp?tz=&jhs={jh}&rq={date_now}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"][0][1]
#     url = f"http://10.84.4.74/yyqer/scbb/r_qkrb_json.jsp?qk={data}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"][-1]
#     res = f"{jh}的区块日报如下：\n"
#     res = res + "|日期|气田|区块|总井数|开井数|生产压力|套压MPa|油压MPa|输压MPa|日产量井口气/10000m3|日产量工业气/10000m3|日产水m3|月产量井口气/10000m3|月产量工业气/10000m3|月产水m3|年产量井口气/10000m3|年产量工业气/10000m3|年产水m3|累产量井口气/10000m3|累产量工业气/10000m3|累产水m3|生产自用气m3|\n"
#     res = res + "|---" * 22 + "|\n"
#     if data == "":
#         return {
#             "result": f"没有{jh}的区块日报数据\n",
#         }
#     res = res + "|" + "|".join(["无" if item == "" else item for item in data]) + "|"
#     return {
#         "result": res[:3000],
#     }
# res = res + "|集气站|井号|加注泵|加注泵编号|加注制度|加注点|值守方式|半月均出水量m3|日出水量m3|药剂罐容量m3|药剂稀释浓度%|加注排量（L/h）|加注时间（h）|每次加注量（L）|每次加注量（Kg）|\n"
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/jtbb/jlsj_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["res"]
#     res = f"{jh}的漏井信息如下：\n"
#     res = res + "|漏失井段|厚度|漏失层位|漏失层岩性|漏速|漏失量|累计漏失量|钻井液密度|钻井液粘度|漏失原因|工况简述|\n"
#     res = res + "|---" * 11 + "|\n"
#     for x in data:
#         for i in range(0,len(x)):
#             x[i] = "无" if x[i] == "" else x[i]
#         res = res + "|" + "|".join(x[3:-1]) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/jtbb/jldt_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["res"]
#     res = f"{jh}的井漏动态如下：\n"
#     res = res + "|井号|序号|漏失层位|顶深(m)|底深(m)|主要岩性|漏失原因|工程简况|漏失量(m³)|累计漏失量(m³)|平均漏速(m³/h)|钻井液密度(g/cm³)|钻井液粘度(s)|备注|\n"
#     res = res + "|---" * 14 + "|\n"
#     for x in data:
#         for i in range(0, len(x)):
#             x[i] = "无" if x[i] == "" else x[i]
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie):
#     url = "http://10.84.4.74/yyqer/dhc/scdt_table_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()
#     print(data)
#     res = "每日生产动态信息如下:\n"
#     res = res + "|截至今日|江汉油田|涪陵公司|采气一厂|\n" + "|---|---|---|---|\n"
#     body = ""
#     for x in data["data"]:
#         body = body + f"|{x[0]}|{x[1] if x[1] else 0}|{x[2] if x[2] else 0}|{x[3] if x[3] else 0}|\n"
#     if body == "":
#         return {
#             "result": "目前没有每日生产动态信息数据\n"
#         }
#     res = res +body
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie):
#     url = "http://10.84.4.74/yyqer/jsgl/reader/tsz_yc_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()
#     res = "目前存在脱水站异常如下：\n"
#     for i in range(len(data["ycnames"])):
#         data["ycnames"][i] += "压损值为"
#     res = res + "|" + "|".join(data["ycnames"]) + "|\n"
#     res = res + "|---" * len(data["ycnames"]) + "|\n"
#     res = res + "|" + "|".join(data["ycvalues"]) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/yjpj/kyxfx/kyxdb_json.jsp?jh={jh}&ljjl=2000&fxlx=null"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["res3"]
#     data2 = response.json()["res4"]
#     res = f"{jh}与邻井的对比如下：\n"
#     res = res + "|井号|水平段长|垂深范围|平均垂深|粘土矿物范围|平均黏土矿物|地层密度方位|平均底层密度|含气饱和度范围|平均含气饱和度|类型|距离|无阻流量|\n"
#     res = res + "|---" * 13 + "|\n"
#     for x in data:
#         for i in range(0, len(x)):
#             x[i] = "无" if x[i] == "" else x[i]
#         res = res + "|" + "|".join(x) + "|\n"
#     for i in range(0, len(data2[0])):
#         data2[0][i] = "无" if data2[0][i] == "" else data2[0][i]
#     res = res + "|" + "|".join(data2[0]) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/gcbb/yx_zjgc_json.jsp"
#     response = requests.post(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"钻井概况如下:\n"
#     res = res + "|钻井队|井号|设计|实钻|钻达层位|当日|月累计|年累计|下部工序|钻机动态|工程简述|\n"
#     res = res + "|---" * 11 + "|\n"
#     for x in data:
#         for i in range(0, len(x)):
#             x[i] = "无" if x[i] == "" else x[i]
#         res = res + "|" + "|".join(x[:6]) + "|" + "|".join(x[17:20]) + "|" + x[21] + "|" + x[22] + "|" + x[20] + "|\n"
#     url = f"http://10.84.4.74/yyqer/dzdx/reader/dxj_json.jsp"
#     response = requests.post(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     titles = response.json()["titles"]
#     res = res + "钻井概况中的导向井如下：\n"
#     res = res + "|" + "|".join(titles) + "|\n"
#     for x in data:
#         for i in range(0, len(x)):
#             x[i] = "无" if x[i] == "" else x[i]
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie: str):
#     url = "http://10.84.4.74/yyqer/sqgc/dhc/yldt_json.jsp"
#     response = requests.post(url, headers={"cookie": cookie})
#     print(response.json())
#     data = response.json()["data"]
#     res = "下面的数据中，阶段为压裂表示这是正在压的井，阶段为试气表示这是试气井，否则表示这是待压井：\n"
#     res = res + "|井号|单位|队号|开工日期|设计段数|已完成段数|下步工序|施工阶段|\n"
#     res = res + "|---" * 8 + "|\n"
#     for x in data:
#         for i in range(0, len(x)):
#             x[i] = "无" if x[i] == "" else x[i]
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/dzdx/sjgl/dxjk_json.jsp?jh={jh}"
#     response = requests.post(url, headers={"cookie": cookie})
#     print(response.json())
#     data = response.json()["dxjk"]
#     res = f"{jh}的导向简况如下:\n"
#     res = res + "|井号|下步导向简况|\n"
#     res = res + "|---" * 2 + "|\n"
#     for x in data:
#         for i in range(0, len(x)):
#             x[i] = "无" if x[i] == "" else x[i]
#         res = res + "|" + "|".join(x[:2]) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/glsj_list.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     nowDate = datetime.now() # 获取当前日期
#     res = f"刮蜡数据如下："
#     res = res + "|井号|刮蜡日期|套压(MPa)|油压(MPa)|刮蜡深度(m)|刮蜡量(Kg)|刮蜡时长(min)|备注|\n"
#     res = res + "|---" * 8 + "|\n"
#     for x in data:
#         if x["RQ"] == "":
#             continue
#         date = datetime.strptime(x["RQ"],"%Y-%m-%d") #获取本行数据的取样日期
#         diff = nowDate - date # 获取差值
#         if diff.days < 30:
#             x = {k: '无' if v == '' else v for k, v in x.items()}
#             res = res + "|" + x["JH"] + "|" + x["RQ"] + "|" + x["TY"] + "|" + x["YY"] + "|" + x["GLSD"] + "|" + x["GLL"] + "|" + x["GLSC"] + "|" + x["BZ"] + "|\n"
#     return {
#         "result": res[:5000],
#     }
# import requests
# def main(cookie: str,jh: str):
#     jhs = jh.split(",")
#     url = f"http://10.84.4.74/yyqer/sssj/djssyj_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"{jh}的实时预警如下："
#     res = res + "|井号|最小压力Mpa|最大压力Mpa|压力波动幅度|最小输压Mpa|最大输压|输压波动幅度|\n"
#     res = res + "|---" * 7 + "|\n"
#     for x in data:
#         for y in jhs:
#             if y in x[1]:
#                 for i in range(0, len(x)):
#                     x[i] = "无" if x[i] == "" else x[i]
#                 res = res + "|" + y + "|".join(x[2:]) + "|\n"
#     return {
#         "result": res[:5000],
#     }
# import requests
# from datetime import datetime
# def main(cookie: str):
#     nowDate = datetime.now()
#     ny = nowDate.strftime("%Y%m")
#     url = f"http://10.84.4.74/yyqer/cqgygl/csgl/yjlltz_list.jsp?whereCause1={ny}&whereCause2={ny}"
#     response = requests.get(url, headers={"cookie": cookie})
#
#     data = response.json()["data"]
#     sortData = sorted(data, key=lambda x: x["RQ"], reverse=True)
#     res = f"集气站领料、转运台账如下："
#     res = res + "|井站|日期|领料/转运类型|药剂种类|厂家|生产时间|数量(桶)|经办人|备注|\n"
#     res = res + "|---" * 9 + "|\n"
#     for x in sortData:
#         x = {k: '无' if v == '' else v for k, v in x.items()}
#         res = res + "|" + x["JZ"] + "|" + x["RQ"] + "|" + x["LX"] + "|" + x["YJZL"] + "|" + x["CJ"] + "|" + x["SCSJ"] + "|" + x["SL"] + "|" + x["JBR"] + "|" + x["BZ"] + "|\n"
#
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie: str):
#     url = "http://10.85.3.61:28078/dataview/data/getDVDataBySql"
#     response = requests.post(url, headers={"cookie": cookie})
#     data = response.json()
#     print(data)
#     res = "异常动态如下：\n"
#     res = res + "|" + "|".join(data["titles"][1:-1]) + "|\n" + "|---" * len(data["titles"][1:-1]) + "|\n"
#     for x in data["data"]:
#         for i in range(0, len(x)):
#             x[i] = "无" if x[i] == "" else x[i]
#         x[1] = x[1].split("</a")[0].split(">")[-1]
#         res = res + "|" + "|".join(x[1:-1]) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/sjtj/sjtj_ylcsjhb_json.jsp?lx=测流压"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     sortData = sorted(data,key = lambda x:x[4], reverse=True)
#     res = "测压计划表如下：\n"
#     res = res + "|井号|投产日期|描述|频率|最近测试日期|4月|5月|6月|7月|8月|9月|10月|11月|12月|\n"
#     res = res + "|---" * 13 + "|\n"
#     for x in sortData:
#         for i in range(0, len(x)):
#             x[i] = "无" if x[i] == "" else x[i]
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie: str,jh: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/yljc/yl_dj_sj.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["res"]
#     sortData = sorted(data,key = lambda x:x[2], reverse=True)
#     res = f"{jh}的单井测压信息如下"
#     res = res + "|层位|测试目的|测压日期|套压MPa|油压MPa|气产量10⁴m³/d|井口温度℃|仪器型号及编号|仪器量程MPa|仪器精度%|井深m|垂深m|压力MPa|压力梯度MPa/100m|温度℃|温度梯度℃/100m|气层中部深度m|液面深度m|气层中部压力MPa|压力系数|备注|\n"
#     res = res + "|---" * 21 + "|\n"
#     for x in sortData:
#         for i in range(0, len(x)):
#             x[i] = "无" if x[i] == "" else x[i]
#         res = res + "|" + "|".join(x[1:]) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime,timedelta
# def main(cookie: str,jh: str):
#     nowDate = datetime.now()
#     preDate = nowDate - timedelta(days = 365)
#     erq = nowDate.strftime("%Y-%m-%d")
#     srq = preDate.strftime("%Y-%m-%d")
#     print(srq,erq)
#     url = f"http://10.84.4.74/yyqer/dtjc/cym_json.jsp?jh={jh}&srq={srq}&erq={erq}"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()["data"]
#     res = f"{jh}的测液面数据如下："
#     res = res + "|井号|油管内径mm|油管外径mm|完井管柱下入深度m|完井管柱底部位置(井斜角)|测试日期|仪器型号|套压MPa|油压MPa|产气量104m3|气层中部深度m|液面深度m|液面垂深m|压力计下入井深m|测压液面深度m|推算静压MPa|备注|测试单位|\n"
#     res = res + "|---" * 17 + "|\n"
#     for x in data:
#         for i in range(0, len(x)):
#             x[i] = "无" if x[i] == "" else x[i]
#         res = res + "|" + "|".join(x) + "|\n"
#     return {
#         "result": res[:3000],
#     }
# import requests
# from datetime import datetime
# def main(cookie: str,jh: str):
#     nowDate = datetime.now()
#     rq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/qcgc/kfxz/kfxz_scyl_json.jsp?rq={rq}"
#     jhs = jh.split(",")
#     Dict = {}
#     for x in jhs:
#         Dict[x] = 1
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()
#     print(data)
#     res = f"{jh}的开发现状如下：\n"
#     res = res + "|井号|生产压力|外输压力|产气量|产水量|水气比|\n"
#     res = res + "|---" * 6 + "|\n"
#     for x in data:
#         if x["jh"] in Dict:
#             x = {k: '无' if v == '' else v for k, v in x.items()}
#             res = res + "|" + x["jh"] + "|" + x["scyl"] + "|" + x["sqyl"] + "|" + x["rcql"] + "|" + x["rcsl"] + "|" + x["sqb"] + "|\n"
#     return {
#         "result": res[:3000],
#     }
import requests
# def main(cookie):
#     url = "http://10.84.4.74/yyqer/dhc/ldjsc_rdsc_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     data = response.json()
#     # 将日期、总日产量、新井产量、措施产量和自然产量提取（2024-2025）
#     dates = [row[0] for row in data["data1_rd_ljzr_0"]]
#     zr_24 = [float(row[1]) for row in data["data1_rd_ljzr_0"]]
#     zr_25 = [float(row[1]) for row in data["data1_rd_ljzr"]]
#     cs_24 = [float(row[1]) for row in data["data2_rd_ljcs_0"]]
#     cs_25 = [float(row[1]) for row in data["data2_rd_ljcs"]]
#     xj_24 = [float(row[1]) for row in data["data3_rd_xjcl_0"]]
#     xj_25 = [float(row[1]) for row in data["data3_rd_xjcl"]]
#     al_24 = [sum(items) for items in zip(zr_24, cs_24, xj_24)]
#     al_25 = [sum(items) for items in zip(zr_25, cs_25, xj_25)]
#     """ 创建完整的ECharts配置 """
#     # 自然产量
#     y_min, y_max = min(min(zr_24), min(zr_25)) - 200, max(max(zr_24), max(zr_25)) + 200
#     zr_config = {
#         "title": {"text": "自然产量"},
#         "tooltip": {"trigger": "axis"},
#         "xAxis": {"type": "category", "data": dates},
#         "yAxis": {"type": "value", "min": y_min, "max": y_max},
#         "series": [
#             {"name": "24年", "type": "line", "data": zr_24, "symbol": "none", "itemStyle": {"color": "blue"}},
#             {"name": "25年", "type": "line", "data": zr_25, "symbol": "none", "itemStyle": {"color": "red"}}
#         ]
#     }
#     zr_output = "```echarts\n" + json.dumps(zr_config, indent=2, ensure_ascii=False) + "\n```"
#     # 措施产量
#     y_min, y_max = min(min(cs_24), min(cs_25)) - 100, max(max(cs_24), max(cs_25)) + 100
#     echarts_config = {
#         "title": {"text": "措施产量"},
#         "tooltip": {"trigger": "axis"},
#         "xAxis": {"type": "category", "data": dates},
#         "yAxis": {"type": "value", "min": y_min, "max": y_max},
#         "series": [
#             {"name": "24年", "type": "line", "data": cs_24, "symbol": "none", "itemStyle": {"color": "blue"}},
#             {"name": "25年", "type": "line", "data": cs_25, "symbol": "none", "itemStyle": {"color": "red"}}
#         ]
#     }
#     cs_output = "```echarts\n" + json.dumps(echarts_config, indent=2, ensure_ascii=False) + "\n```"
#     # 新井产量
#     y_max = max(max(xj_24), max(xj_25)) + 50
#     xj_config = {
#         "title": {"text": "新井产量"},
#         "tooltip": {"trigger": "axis"},
#         "xAxis": {"type": "category", "data": dates},
#         "yAxis": {"type": "value", "min": 0, "max": y_max},
#         "series": [
#             {"name": "24年", "type": "line", "data": xj_24, "symbol": "none", "itemStyle": {"color": "blue"}},
#             {"name": "25年", "type": "line", "data": xj_25, "symbol": "none", "itemStyle": {"color": "red"}}
#         ]
#     }
#     xj_output = "```echarts\n" + json.dumps(xj_config, indent=2, ensure_ascii=False) + "\n```"
#     # 总日产量
#     y_min, y_max = min(min(al_24), min(al_25)) - 200, max(max(al_24), max(al_24)) + 200
#     al_config = {
#         "title": {"text": "总日产量"},
#         "tooltip": {"trigger": "axis"},
#         "xAxis": {"type": "category", "data": dates},
#         "yAxis": {"type": "value", "min": y_min, "max": y_max},
#         "series": [
#             {"name": "24年", "type": "line", "data": al_24, "symbol": "none", "itemStyle": {"color": "blue"}},
#             {"name": "25年", "type": "line", "data": al_25, "symbol": "none", "itemStyle": {"color": "red"}}
#         ]
#     }
#     al_output = "```echarts\n" + json.dumps(al_config, indent=2, ensure_ascii=False) + "\n```"
#     return {
#         "zr_output": zr_output,
#         "cs_output": cs_output,
#         "xj_output": xj_output,
#         "al_output": al_output,
#     }
# import requests
# def main():
#
#     echarts_config = {
#         "title": {
#             "text": "销售占比",
#             "left": "center"
#         },
#         "tooltip": {
#             "trigger": "item",
#             "formatter": "{a} <br/>{b}: {c} ({d}%)"
#         },
#         # "legend": {
#         #     "orient": "vertical",
#         #     "left": "left",
#         #     "data": ["服饰", "数码", "家居", "食品", "图书","体育"]
#         # },
#         "series": [{
#             "name": "销售占比",
#             "type": "pie",
#             "radius": "50%",
#             "data": [
#                 {"value": 335, "name": "服饰"},
#                 {"value": 310, "name": "数码"},
#                 {"value": 234, "name": "家居"},
#                 {"value": 135, "name": "食品"},
#                 {"value": 1548, "name": "图书"},
#                 {"value": 500, "name": "体育"}
#             ],
#             "emphasis": {
#                 "itemStyle": {
#                 "shadowBlur": 10,
#                 "shadowOffsetX": 0,
#                 "shadowColor": "rgba(0, 0, 0, 0.5)"
#                 }
#             },
#             "label": {
#             "show": True,
#             "formatter": "{b}: {d}%",
#             "color": "#333"
#             },
#             "avoidLabelOverlap": True
#         }]
#     }
#     output = "```echarts\n" + json.dumps(echarts_config, indent=2, ensure_ascii=False) + "\n```"
#     return output
# # res = main("userName=wlx2023.jhyt; password=; JSESSIONID=3F6D910572112B5735FCA9EBB7CB367E")
# # #print(len(res["result"]))
# # print(res)
# str_arr = ""
# arr = str_arr.split(",")
# print(len(arr))
# print(arr)
# import requests
# from datetime import datetime,timedelta
# def main(cookie):
#     header = {
#         "Cookie": cookie
#     }
#     # 输差分析
#     nowDate = datetime.now()
#     preDate = nowDate - timedelta(days=10)
#     srq = preDate.strftime("%Y-%m-%d")
#     erq = nowDate.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/jsgl/scfx/scrb_json.jsp?srq={srq}&erq={erq}"
#     resp = requests.get(url, headers=header).json()["res"][-1]
#     res = "输差分析如下：\n"
#     res = res + "|日期|总销售量|总输差|总输差(%)|一、二、三区销售合计|一、二、三区工业气|一、二、三区输差|一、二、三区输差(%)|四区销售合计|四区工业气|四区输差|四区输差(%)|平桥区块工业气|凤来区块工业气|平桥+凤来输差|平桥+凤来输差(%)|白马输差|白马输差(%)|\n" + "|--"*18 + "|\n|"
#     res = res + "|".join(resp) +"|"
#     return {
#         "result": res[:3000],
#     }
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/dhc/rdcxqx_json.jsp"
#
#     response = requests.get(url, headers={"cookie": cookie})
#     in_data = response.json()["data"]
#     data1 = ""
#     data2 = ""
#     x_axis = ""
#     for x in in_data:
#         x_axis += x[0] + ","
#         data1 += x[1] + ","
#         data2 += x[2] + ","
#     data1 = data1[:-1]
#     data1 += ";"
#     data2 = data2[:-1]
#     x_axis = x_axis[:-1]
#     return {
#         "title": "日度产销曲线",
#         "yname": "产销量(万方)",
#         "lname": "日产气量,日销气量",
#         "data": data1 + data2,
#         "x_axis": x_axis
#     }
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/dhc/rdcxqx_json.jsp"
#
#     response = requests.get(url, headers={"cookie": cookie})
#     in_data = response.json()["data"]
#     data1 = ""
#     data2 = ""
#     x_axis = ""
#     for x in in_data:
#         x_axis += x[0] + ","
#         data1 += x[3] + ","
#         data2 += x[4] + ","
#     data1 = data1[:-1]
#     data1 += ";"
#     data2 = data2[:-1]
#     x_axis = x_axis[:-1]
#     return {
#         "title": "年累计产销曲线",
#         "yname": "产销量(亿方)",
#         "lname": "年产气量,年销气量",
#         "data": data1 + data2,
#         "x_axis": x_axis
#     }
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/dhc/ldjsc_rdsc_json.jsp"
#
#     response = requests.get(url, headers={"cookie": cookie})
#     in_data1 = response.json()["data1_rd_ljzr_0"]
#     in_data2 = response.json()["data1_rd_ljzr"]
#     print(in_data2)
#     now_nd = response.json()["nd"]
#     pre_nd = str(int(now_nd) - 1)
#     data1 = ""
#     data2 = ""
#     x_axis = ""
#     # 处理平年闰年差一天的问题，给闰年也加上2月29日的数据为0
#     for i in range(len(in_data1)):
#         if in_data1[i][0] == "03-01" and in_data1[i-1][0] == "02-28":
#             x_axis += "02-29,"
#             data1 += "0,"
#         x_axis += in_data1[i][0] + ","
#         data1 += in_data1[i][1] + ","
#     for i in range(len(in_data2)):
#         if in_data2[i][0] == "03-01" and in_data2[i-1][0] == "02-28":
#             data2 += "0,"
#         data2 += in_data2[i][1] + ","
#     x_axis = x_axis[:-1]
#     data1 = data1[:-1]
#     data1 += ";"
#     data2 = data2[:-1]
#     return {
#         "title": "自然产量曲线",
#         "yname": "自然产量",
#         "lname": pre_nd + "," + now_nd,
#         "data": data1 + data2,
#         "x_axis": x_axis
#     }
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/dhc/ldjsc_rdsc_json.jsp"
#
#     response = requests.get(url, headers={"cookie": cookie})
#     in_data1 = response.json()["data2_rd_ljcs_0"]
#     in_data2 = response.json()["data2_rd_ljcs"]
#     now_nd = response.json()["nd"]
#     pre_nd = str(int(now_nd) - 1)
#     data1 = ""
#     data2 = ""
#     x_axis = ""
#     # 处理平年闰年差一天的问题，给闰年也加上2月29日的数据为0
#     for i in range(len(in_data1)):
#         if in_data1[i][0] == "03-01" and in_data1[i-1][0] == "02-28":
#             x_axis += "02-29,"
#             data1 += "0,"
#         x_axis += in_data1[i][0] + ","
#         data1 += in_data1[i][1] + ","
#     for i in range(len(in_data2)):
#         if in_data2[i][0] == "03-01" and in_data2[i-1][0] == "02-28":
#             data2 += "0,"
#         data2 += in_data2[i][1] + ","
#     x_axis = x_axis[:-1]
#     data1 = data1[:-1]
#     data1 += ";"
#     data2 = data2[:-1]
#     return {
#         "title": "措施产量曲线",
#         "yname": "措施产量",
#         "lname": pre_nd + "," + now_nd,
#         "data": data1 + data2,
#         "x_axis": x_axis
#     }
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/dhc/ldjsc_rdsc_json.jsp"
#
#     response = requests.get(url, headers={"cookie": cookie})
#     zr_24 = response.json()["data1_rd_ljzr_0"]
#     zr_25 = response.json()["data1_rd_ljzr"]
#     cs_24 = response.json()["data2_rd_ljcs_0"]
#     cs_25 = response.json()["data2_rd_ljcs"]
#     xj_24 = response.json()["data3_rd_xjcl_0"]
#     xj_25 = response.json()["data3_rd_xjcl"]
#     al_24 = [sum(float(num[1]) for num in items) for items in zip(zr_24, cs_24, xj_24)]
#     al_25 = [sum(float(num[1]) for num in items) for items in zip(zr_25, cs_25, xj_25)]
#     now_nd = response.json()["nd"]
#     pre_nd = str(int(now_nd) - 1)
#     data1 = ""
#     data2 = ""
#     x_axis = ""
#     # 处理平年闰年差一天的问题，给闰年也加上2月29日的数据为0
#     for i in range(len(al_24)):
#         if zr_24[i][0] == "03-01" and zr_24[i-1][0] == "02-28":
#             x_axis += "02-29,"
#             data1 += "0,"
#         x_axis += zr_24[i][0] + ","
#         data1 += str(al_24[i]) + ","
#     for i in range(len(al_25)):
#         if zr_25[i][0] == "03-01" and zr_25[i-1][0] == "02-28":
#             data2 += "0,"
#         data2 += str(al_24[i]) + ","
#     x_axis = x_axis[:-1]
#     data1 = data1[:-1]
#     data1 += ";"
#     data2 = data2[:-1]
#     return {
#         "title": "总日产量曲线",
#         "yname": "总日产量",
#         "lname": pre_nd + "," + now_nd,
#         "data": data1 + data2,
#         "x_axis": x_axis
#     }
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/dhc/fyjhdb_json.jsp"
#
#     response = requests.get(url, headers={"cookie": cookie})
#     in_data = response.json()["data"]
#     data1 = ""
#     data2 = ""
#     x_axis = ""
#     # 处理平年闰年差一天的问题，给闰年也加上2月29日的数据为0
#     for x in in_data:
#         x_axis += x[0] + ","
#         data1 += x[2] + ","
#         data2 += x[1] + ","
#     x_axis = x_axis[:-1]
#     data1 = data1[:-1]
#     data1 += ";"
#     data2 = data2[:-1]
#     return {
#         "title": "计划产量",
#         "yname": "产气量(亿方)",
#         "lname": "计划产量,实际产量",
#         "data": data1 + data2,
#         "x_axis": x_axis
#     }
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/dhc/fyjhdb_json.jsp"
#
#     response = requests.get(url, headers={"cookie": cookie})
#     in_data = response.json()["data"]
#     data1 = ""
#     data2 = ""
#     x_axis = ""
#     # 处理平年闰年差一天的问题，给闰年也加上2月29日的数据为0
#     for x in in_data:
#         x_axis += x[0] + ","
#         data1 += x[4] + ","
#         data2 += x[3] + ","
#     x_axis = x_axis[:-1]
#     data1 = data1[:-1]
#     data1 += ";"
#     data2 = data2[:-1]
#     return {
#         "title": "计划销量",
#         "yname": "销售气量(亿方)",
#         "lname": "计划销售,实际销售",
#         "data": data1 + data2,
#         "x_axis": x_axis
#     }
# import requests
# def main(cookie: str, jh: str, jh1: str):
#     form_data = {
#         "selstr": "1000,2001,3003,3008",
#         "flag": "1",
#         "jh": jh,  # 示例："焦页7-S1HF,焦页7-S2HF,焦页7-S3HF"
#         "jh1": jh1,  # 示例："焦页8-3HF,焦页8-4HF,焦页8-5HF"
#         "fxlx": "zhpj"
#     }
#     headers = {
#         "Cookie": cookie,
#         "Content-Type": "application/x-www-form-urlencoded"
#     }
#     url = "http://10.84.4.74/yyqer/yjpj/zhpj/zhpj_tjfb_json.jsp"
#     response = requests.post(
#         url=url,
#         headers=headers,
#         data=form_data  # 表单数据用data参数传递
#     )
#     print(response.text[:500])
#     fbnum0 = response.json()["fbnum"][0]
#     fbnum1 = response.json()["fbnum"][2]
#     step = (float(response.json()["zd"]) - float(response.json()["zx"])) / len(fbnum0)
#     star = float(response.json()["zx"])
#     data1 = ""
#     data2 = ""
#     data3 = ""
#     x_axis = ""
#     # 处理平年闰年差一天的问题，给闰年也加上2月29日的数据为0
#     for i in range(0,len(fbnum0)):
#         x_axis += str(star + step * i) + ","
#         data1 += fbnum0[0][i] + ","
#         data2 += fbnum1[0][i] + ","
#         if fbnum0[0][i] == "0" or fbnum1[0][i] == "0":
#             data3 += "0,"
#         else:
#             data3 += str(int(fbnum0[0][i]) / int(fbnum1[0][i]))
#     x_axis = x_axis[:-1]
#     data1 = data1[:-1]
#     data1 += ";"
#     data2 = data2[:-1]
#     data2 += ";"
#     data3 = data3[:-1]
#     return {
#         "title": "垂深分布图",
#         "yname": "井数",
#         "lname": "选择井,对比井,选择井/对比井",
#         "data": data1 + data2 + data3,
#         "x_axis": x_axis
#     }
# res = main("userName=wlx2023.jhyt; password=; JSESSIONID=11B8C7933B27A2CEBEB7FC83A1AE3C9F"
#            ,"焦页7-S1HF,焦页7-S2HF,焦页7-S3HF,焦页7-S4HF,焦页7-Z1HF,焦页7-Z2HF"
#            ,"焦页8-3HF,焦页8-4HF,焦页8-5HF,焦页8-6HF,焦页8-7HF,焦页8-8HF,焦页8-9HF,焦页8-S1HF,焦页8-S2HF,焦页8-S3HF,焦页8-S4HF,焦页8-S5HF")
# print(res)

#生产总览
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/sqgc/dhc/sqdhc_json.jsp"
#
#     response = requests.get(url, headers={"cookie": cookie})
#     ylsqtj = response.json()["ylsqtj"]
#     data1 = ""
#     data2 = ""
#     data3 = ""
#     data4 = ""
#     x_axis = ""
#     for x in ylsqtj:
#         x_axis += x[0] + "月,"
#         data1 += x[1] + ","
#         data2 += x[2] + ","
#         data3 += x[3] + ","
#         data4 += x[4] + ","
#     x_axis = x_axis[:-1]
#     data1 = data1[:-1]
#     data1 += ";"
#     data2 = data2[:-1]
#     data2 += ";"
#     data3 = data3[:-1]
#     data3 += ";"
#     data4 = data4[:-1]
#     return {
#         "title": "生产总览",
#         "yname": "井数(口)",
#         "lname": "月开始压裂,月完成试气,年开始压裂,年完成试气",
#         "data": data1 + data2 + data3 + data4,
#         "x_axis": x_axis
#     }

#施工质量异常统计
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/sqgc/dhc/sqdhc_json.jsp"
#
#     response = requests.get(url, headers={"cookie": cookie})
#     ycjc = response.json()["ycjc"]
#     data1 = ""
#     data2 = ""
#     data3 = ""
#     data4 = ""
#     x_axis = ""
#     for x in ycjc:
#         x_axis += str(x[0]) + "月,"
#         data1 += str(x[1]) + ","
#         data2 += str(x[2]) + ","
#         data3 += str(x[3]) + ","
#         data4 += str(x[4]) + ","
#     x_axis = x_axis[:-1]
#     data1 = data1[:-1]
#     data1 += ";"
#     data2 = data2[:-1]
#     data2 += ";"
#     data3 = data3[:-1]
#     data3 += ";"
#     data4 = data4[:-1]
#     return {
#         "title": "施工质量异常统计",
#         "yname": "施工异常统计",
#         "lname": "华美,江汉,胜利,中原",
#         "data": data1 + data2 + data3 + data4,
#         "x_axis": x_axis
#     }

#压裂曲线
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/sqgc/ssjc/ssyl_qx_json.jsp?jh={jh}"
#
#     response = requests.get(url, headers={"cookie": cookie})
#     res = response.json()["res"]
#     data1 = ""
#     data2 = ""
#     x_axis = ""
#     i = 0
#     for x in res:
#         if i == 360:
#             break
#         x_axis += x[1] + ","
#         data1 += x[8] + ","
#         data2 += x[9] + ","
#         i += 1
#     x_axis = x_axis[:-1]
#     data1 = data1[:-1]
#     data1 += ";"
#     data2 = data2[:-1]
#     return {
#         "title": "",
#         "yname": "累砂量,累液量(方)",
#         "lname": "累计砂量,累计液量",
#         "data": data1 + data2,
#         "x_axis": x_axis
#     }

#单井分析
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/sqgc/yhfx/danjfx_json.jsp?jh={jh}"
#
#     response = requests.get(url, headers={"cookie": cookie})
#     in_data = response.json()["data"]
#     kjyl_data = ""
#     sjyl_data = ""
#     plyl_data = ""
#     tbyl_data = ""
#     yl_data = ""
#     dcyl_data = ""
#     sl_data = ""
#     dcsl_data = ""
#     ysyl_data = ""
#     yspl_data = ""
#     zcjjl_data_1 = ""
#     zcjjl_data_2 = ""
#     zcjjl_data_3 = ""
#     x_axis = ""
#     for x in in_data:
#         x_axis += x[0] + ","
#         kjyl_data += x[17] + ","
#         sjyl_data += x[22] + ","
#         plyl_data += x[18] + ","
#         tbyl_data += x[19] + ","
#         yl_data += x[9] + ","
#         dcyl_data += x[71] + ","
#         sl_data  += x[11] + ","
#         dcsl_data += x[72] + ","
#         ysyl_data += x[62] + ","
#         yspl_data += x[70] + ","
#         zcjjl_data_1 += x[27] + ","
#         zcjjl_data_2 += x[32] + ","
#         zcjjl_data_3 += x[37] + ","
#     x_axis = x_axis[:-1]
#
#     kjyl_data = kjyl_data[:-1]
#     kjyl_data += ";"
#     sjyl_data = sjyl_data[:-1]
#     sjyl_data += ";"
#     plyl_data = plyl_data[:-1]
#     plyl_data += ";"
#     tbyl_data = tbyl_data[:-1]
#     tbyl_data += ";"
#     ysyl_data = ysyl_data[:-1]
#     print(ysyl_data)
#
#     yl_data = yl_data[:-1]
#     yl_data += ";"
#     dcyl_data = dcyl_data[:-1]
#     dcyl_data += ";"
#     sl_data = sl_data[:-1]
#     sl_data += ";"
#     dcsl_data = dcsl_data[:-1]
#
#     yspl_data = yspl_data[:-1]
#
#     zcjjl_data_1 = zcjjl_data_1[:-1]
#     zcjjl_data_1 += ";"
#     zcjjl_data_2 = zcjjl_data_2[:-1]
#     zcjjl_data_2 += ";"
#     zcjjl_data_3 = zcjjl_data_3[:-1]
#
#     return {
#         "title1": "",
#         "title2": "",
#         "title3": "",
#         "title4": "支撑剂加量",
#         "yname1": "(Mpa)",
#         "yname2": "(m³)",
#         "yname3": "(m³/min)",
#         "yname4": "支撑剂加量",
#         "lname1": "开井压力,酸降压力,破裂压力,停泵压力,延伸压力",
#         "lname2": "液量,单簇液量,砂量,单簇砂量",
#         "lname3": "延伸排量",
#         "lname4": "100目,40/70目,30/50目",
#         "data1": kjyl_data + sjyl_data + plyl_data + tbyl_data + ysyl_data,
#         "data2": yl_data + dcyl_data + sl_data + dcsl_data,
#         "data3": yspl_data,
#         "data4": zcjjl_data_1 + zcjjl_data_2 + zcjjl_data_3,
#         "x_axis": x_axis
#     }

#单井特征
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/yjpj/zhpj/zhpj_dhfx_json.jsp?jh={jh}&flag=4&fxlx=kyx"
#
#     response = requests.get(url, headers={"cookie": cookie})
#     in_data = response.json()["res"]
#     print(in_data)
#     csjj_data = ""
#     cxkwjj_data = ""
#     hqbhdjj_data = ""
#     plyljj_data = ""
#     x_axis = ""
#     for x in in_data:
#         x_axis += x[2] + ","
#         csjj_data += x[3] + ","
#         cxkwjj_data += x[4] + ","
#         hqbhdjj_data += x[5] + ","
#         plyljj_data += x[6] + ","
#
#     x_axis = x_axis[:-1]
#     csjj_data = csjj_data[:-1]
#     cxkwjj_data = cxkwjj_data[:-1]
#     hqbhdjj_data = hqbhdjj_data[:-1]
#     plyljj_data = plyljj_data[:-1]
#     return {
#         "title1": "",
#         "title2": "",
#         "title3": "",
#         "title4": "",
#         "yname1": "垂深卷积",
#         "yname2": "脆性矿物卷积",
#         "yname3": "含气饱和度卷积",
#         "yname4": "破裂压力卷积",
#         "lname1": "",
#         "lname2": "",
#         "lname3": "",
#         "lname4": "",
#         "data1": csjj_data,
#         "data2": cxkwjj_data,
#         "data3": hqbhdjj_data,
#         "data4": plyljj_data,
#         "x_axis": x_axis
#     }

#G函数
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/sqgc/gfunc/gfunc_dd_json.jsp?jh={jh}&ylxh=1&psmooth=0"
#
#     response = requests.get(url, headers={"cookie": cookie})
#     t = response.json()["t"]
#     x_axis = ""
#     for x in t:
#         x_axis += str(x) + ","
#     x_axis = x_axis[:-1]
#
#     p = response.json()["p"]
#     data1 = ""
#     for x in p:
#         data1 += str(x) + ","
#     data1 = data1[:-1]
#     data1 += ";"
#
#     dpdg = response.json()["dpdg"]
#     data2 = ""
#     for x in dpdg:
#         data2 += str(x) + ","
#     data2 = data2[:-1]
#
#     return{
#         "tittle": "G函数曲线",
#         "yname": "",
#         "lname": "停泵后压力(MPa),GdP/dG",
#         "data": data1 + data2,
#         "x_axis": x_axis
#     }

#设计符合率
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/sqgc/sgfhl_json.jsp?jh={jh}"
#
#     response = requests.get(url, headers={"cookie": cookie})
#     in_data = response.json()["data"]
#     x_axis = ""
#     data1 = ""
#     data2 = ""
#     for x in in_data:
#         x_axis += x[1] + ","
#         data1 += x[4] + ","
#         data2 += x[7] + ","
#     x_axis = x_axis[:-1]
#     data1 = data1[:-1]
#     data1 += ";"
#     data2 = data2[:-1]
#     return{
#         "title": "设计符合率曲线",
#         "yname": "符合率",
#         "lname": "加砂量设计符合率,液量设计符合率",
#         "data": data1 + data2,
#         "x_axis": x_axis
#     }

#产量综合
# import requests
# def main(cookie: str, jh: str):
#     url = f"http://10.84.4.74/yyqer/kfdtgl/qcfx/zhqx_json.jsp?jh={jh}"
#
#     response = requests.get(url, headers={"cookie": cookie})
#     res = response.json()["res"]
#     x_axis = ""
#     data1 = ""
#     data2 = ""
#     data3 = ""
#     for x in res:
#         x_axis += x[0] + ","
#         data1 += x[1] + ","
#         data2 += x[2] + ","
#         data3 += x[3] + ","
#     x_axis = x_axis[:-1]
#     data1 = data1[:-1]
#     data2 = data2[:-1]
#     data3 = data3[:-1]
#     return{
#         "title1": "日产气量曲线",
#         "title2": "日产水量曲线",
#         "title3": "水气比曲线",
#         "yname1": "日产气量(万方)",
#         "yname2": "日产水量(方)",
#         "yname3": "水气比(方/万方)",
#         "lname1": "",
#         "lname2": "",
#         "lname3": "",
#         "data1": data1,
#         "data2": data2,
#         "data3": data3,
#         "x_axis": x_axis
#     }

#新老井产量构成
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/qcgc/cnzb/ymsphd_5_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     ljzr_data = response.json()["data"]
#     url = f"http://10.84.4.74/yyqer/qcgc/cnzb/ymsphd_4_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     ljcs_data = response.json()["data"]
#     url = f"http://10.84.4.74/yyqer/qcgc/cnzb/ymsphd_2_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     xj_data = response.json()["data"]
#     x_axis = ""
#     data1 = ""
#     data2 = ""
#     data3 = ""
#     for x in ljzr_data:
#         x_axis += x[1] + ","
#         data1 += x[2] + ","
#     for x in ljcs_data:
#         data2 += x[2] + ","
#     for x in xj_data:
#         data3 += x[2] + ","
#     x_axis = x_axis[:-1]
#     data1 = data1[:-1]
#     data1 += ";"
#     data2 = data2[:-1]
#     data2 += ";"
#     data3 = data3[:-1]
#     return{
#         "title1": "新老井产量构成曲线",
#         "yname1": "产量量(亿方)",
#         "lname1": "老井自然,老井措施,新井",
#         "data1": data1 + data2 + data3,
#         "x_axis": x_axis
#     }

#分年产量构成
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/qcgc/dhc/qkclgc_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     in_data = response.json()["data"]
#     qk = response.json()["qk"]
#
#     x_axis = ""
#     data1 = ""
#     data2 = ""
#     data3 = ""
#     data4 = ""
#     data5 = ""
#     data6 = ""
#     lname = ""
#     for x in in_data:
#         x_axis += x[0] + ","
#         data1 += x[1] + ","
#         data2 += x[2] + ","
#         data3 += x[3] + ","
#         data4 += x[4] + ","
#         data5 += x[5] + ","
#         data6 += x[6] + ","
#     for x in qk:
#         lname += x + ","
#     x_axis = x_axis[:-1]
#     lname = lname[:-1]
#     data1 = data1[:-1]
#     data1 += ";"
#     data2 = data2[:-1]
#     data2 += ";"
#     data3 = data3[:-1]
#     data3 += ";"
#     data4 = data4[:-1]
#     data4 += ";"
#     data5 = data5[:-1]
#     data5 += ";"
#     data6 = data6[:-1]
#     return{
#         "title": "分年产量构成曲线",
#         "yname": "日产气量(万方)",
#         "lname": lname,
#         "data": data1 + data2 + data3 + data4 + data5 + data6,
#         "x_axis": x_axis
#     }
# 自然递减
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/qcgc/cnzb/ymsphd_7_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     res = response.json()["res"]
#
#     x_axis = ""
#     data = ""
#     for x in res:
#         x_axis += x[0] + ","
#         data += x[4] + ","
#     x_axis = x_axis[:-1]
#     data = data[:-1]
#     return{
#         "title": "自然递减曲线",
#         "yname": "递减率",
#         "lname": "",
#         "data": data,
#         "x_axis": x_axis
#     }

#分年日均产量构成
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/kfdtgl/qcfx/fnclgcqx_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     in_data = response.json()["data"]
#     qk = response.json()["qk"]
#
#     x_axis = ""
#     data = [""] * len(qk)
#     lname = ""
#     for x in in_data:
#         x_axis += x[0] + ","
#         for i in range(1,len(x)):
#             data[i-1] += x[i] + ","
#     for x in qk:
#         lname += x + ","
#     x_axis = x_axis[:-1]
#     lname = lname[:-1]
#     final_result = ""
#     for x in data:
#         final_result += x[:-1] + ";"
#     final_result = final_result[:-1]
#     return{
#         "title": "分年日均产量构成曲线",
#         "yname": "月均日产量(万方)",
#         "lname": lname,
#         "data": final_result,
#         "x_axis": x_axis
#     }

# 区块日均产量构成
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/qcgc/dhc/qkclgc_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     in_data = response.json()["data"]
#     qk = response.json()["qk"]
#
#     x_axis = ""
#     data = [""] * len(qk)
#     lname = ""
#     for x in in_data:
#         x_axis += x[0] + ","
#         for i in range(1,len(x)):
#             data[i-1] += x[i] + ","
#     for x in qk:
#         lname += x + ","
#     x_axis = x_axis[:-1]
#     lname = lname[:-1]
#     final_result = ""
#     for x in data:
#         final_result += x[:-1] + ";"
#     final_result = final_result[:-1]
#     return{
#         "title": "分年产量构成曲线",
#         "yname": "日产气量(万方)",
#         "lname": lname,
#         "data": final_result,
#         "x_axis": x_axis
#     }

#开发现状
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/qcgc/kfxz/kfxz_scyl_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     scyl_count = [0,0,0,0,0]
#     wsyl_count = [0,0,0,0,0]
#     cql_count = [0,0,0,0,0]
#     csl_count = [0,0,0,0,0]
#     sqb_count = [0,0,0,0,0]
#
#     for x in response.json():
#         try:
#             float(x["scyl"])
#         except:
#             x["scyl"] = "-1"
#         if 0 <= float(x["scyl"]) < 3:
#             scyl_count[0] += 1
#         elif 3 <= float(x["scyl"]) < 6:
#             scyl_count[1] += 1
#         elif 6 <= float(x["scyl"]) < 10:
#             scyl_count[2] += 1
#         elif 10 <= float(x["scyl"]) < 15:
#             scyl_count[3] += 1
#         elif 15 <= float(x["scyl"]):
#             scyl_count[4] += 1
#
#         try:
#             float(x["sqyl"])
#         except:
#             x["sqyl"] = "-1"
#         if 0 <= float(x["sqyl"]) < 3:
#             wsyl_count[0] += 1
#         elif 3 <= float(x["sqyl"]) < 4:
#             wsyl_count[1] += 1
#         elif 4 <= float(x["sqyl"]) < 5:
#             wsyl_count[2] += 1
#         elif 5 <= float(x["sqyl"]) < 6:
#             wsyl_count[3] += 1
#         elif 6 <= float(x["sqyl"]):
#             wsyl_count[4] += 1
#
#         try:
#             float(x["rcql"])
#         except:
#             x["rcql"] = "-1"
#         if 0 <= float(x["rcql"]) < 1:
#             cql_count[0] += 1
#         elif 1 <= float(x["rcql"]) < 3:
#             cql_count[1] += 1
#         elif 3 <= float(x["rcql"]) < 5:
#             cql_count[2] += 1
#         elif 5 <= float(x["rcql"]) < 8:
#             cql_count[3] += 1
#         elif 8 <= float(x["rcql"]):
#             cql_count[4] += 1
#
#         try:
#             float(x["rcsl"])
#         except:
#             x["rcsl"] = "-1"
#         if 0 <= float(x["rcsl"]) < 1:
#             csl_count[0] += 1
#         elif 1 <= float(x["rcsl"]) < 5:
#             csl_count[1] += 1
#         elif 5 <= float(x["rcsl"]) < 20:
#             csl_count[2] += 1
#         elif 20 <= float(x["rcsl"]) < 50:
#             csl_count[3] += 1
#         elif 50 <= float(x["rcsl"]):
#             csl_count[4] += 1
#
#         try:
#             float(x["sqb"])
#         except:
#             x["sqb"] = "-1"
#         if 0 <= float(x["sqb"]) < 0.5:
#             sqb_count[0] += 1
#         elif 0.5 <= float(x["sqb"]) < 1:
#             sqb_count[1] += 1
#         elif 1<= float(x["sqb"]) < 2:
#             sqb_count[2] += 1
#         elif 2 <= float(x["sqb"]) < 5:
#             sqb_count[3] += 1
#         elif 5 <= float(x["sqb"]):
#             sqb_count[4] += 1
#     return{
#         "title1": "生产压力分布",
#         "title2": "外输压力分布",
#         "title3": "产气量分布",
#         "title4": "产水量分布",
#         "title5": "水气比分布",
#         "name1": "0~3MPa,3~6(MPa),6~10(MPa),10~15(MPa),15+(MPa)",
#         "name2": "0~3(MPa),3~4(MPa),4~5(MPa),5~6(MPa),6+(MPa)",
#         "name3": "0~1(万方),1~3(万方),3~5(万方),5~8(万方),8+(万方)",
#         "name4": "0~1(方),1~5(方),5~20(方),20~50(方),50+(方)",
#         "name5": "0~0.5,0.5~1,1~2,2~5,5+",
#         "value1": ",".join(map(str,scyl_count)),
#         "value2": ",".join(map(str,wsyl_count)),
#         "value3": ",".join(map(str,cql_count)),
#         "value4": ",".join(map(str,csl_count)),
#         "value5": ",".join(map(str,sqb_count)),
#     }

#生产指标
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/qcgc/cnzb/sczb_qx_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     res = response.json()["res"]
#
#     x_axis = ""
#     data1 = data2 = ""
#     data3 = data4 = data5 = ""
#     data6 = data7 = data8 = ""
#     data9 = data10 = data11 = data12 = data13 = data14 = data15 = ""
#     for x in res:
#         x_axis += x[0] + ","
#         data1 += x[1] + ","
#         data2 += x[2] + ","
#         data3 += x[3] + ","
#         data4 += x[4] + ","
#         data5 += str(float(x[3]) + float(x[4])) + ","
#         data6 += x[5] + ","
#         data7 += x[6] + ","
#         data8 += str(float(x[5]) + float(x[6])) + ","
#         data9 += x[9] + ","
#         data10 += x[10] + ","
#         data11 += x[11] + ","
#         data12 += x[12] + ","
#         data13 += x[13] + ","
#         data14 += x[14] + ","
#         data15 += x[15] + ","
#
#     return{
#         "title1": "",
#         "yname1": "井数(口)",
#         "lname1": "总井数,开井数",
#         "data1": data1[:-1] + ";" + data2[:-1],
#         "title2": "",
#         "yname2": "日产气量(万方)",
#         "lname2": "老井日产气,新井日产气,总产气量",
#         "data2": data3[:-1] + ";" + data4[:-1] + ";" + data5[:-1],
#         "title3": "",
#         "yname3": "日产水量(万方)",
#         "lname3": "老井日产水,新井日产水,总产水量",
#         "data3": data6[:-1] + ";" + data7[:-1] + ";" + data8[:-1],
#         "title4": "月度压力变化",
#         "yname4": "压力(MPa)",
#         "lname4": "套压,油压,输压,新井套压,新井油压,老井套压,老井油压",
#         "data4": data9[:-1] + ";" + data10[:-1] + ";" + data11[:-1] + ";" + data12[:-1] + ";" + data13[:-1] + ";" + data14[:-1] + ";" + data15[:-1],
#         "x_axis": x_axis
#     }

#单井生产
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/scbb/r_scqx_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     res = response.json()["res"]
#
#     x_axis = ""
#     data1 = ""
#     data2 = data3 = ""
#     data4 = data5 = ""
#     data6 = ""
#
#     for x in res:
#         x_axis += x[17] + ","
#         data1 += x[0] + ","
#         data2 += x[8] + ","
#         data3 += x[7] + ","
#         data4 += x[3] + ","
#         data5 += x[25] + ","
#         data6 += x[2] + ","
#
#     return{
#         "title1": "生产时间",
#         "yname1": "小时",
#         "lname1": "",
#         "data1": data1[:-1],
#         "title2": "压力",
#         "yname2": "MPa",
#         "lname2": "套压,油压",
#         "data2": data2[:-1] + ";" + data3[:-1],
#         "title3": "日产气量",
#         "yname3": "万方",
#         "lname3": "日产气量,临界携液流量",
#         "data3": data4[:-1] + ";" + data5[:-1],
#         "title4": "日产水量",
#         "yname4": "万方",
#         "lname4": "",
#         "data4": data6[:-1],
#         "x_axis": x_axis,
#     }
#涪陵气田生产曲线
# import requests
# def main(cookie: str):
#     url = f"http://10.84.4.74/yyqer/qcgc/kfqs/clfx_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     in_data = response.json()["data"]
#
#     x_axis = ""
#     data1 = ""
#     data2 = data3 = ""
#
#     for x in in_data:
#         x_axis += x[0] + ","
#         data1 += x[7] + ","
#         data2 += x[3] + ","
#         data3 += x[4] + ","
#
#     return{
#         "title1": "日产气量",
#         "yname1": "万方",
#         "lname1": "",
#         "data1": data1[:-1],
#         "title2": "压力",
#         "yname2": "MPa",
#         "lname2": "生产压力,输压",
#         "data2": data2[:-1] + ";" + data3[:-1],
#         "x_axis": x_axis,
#     }

#涪陵气田时间归一化生产曲线
# import requests
# def main(cookie: str,jh: str):
#     url = f"http://10.84.4.74/yyqer/qcgc/kfqs/qktcndcl_json.jsp"
#     response = requests.get(url, headers={"cookie": cookie})
#     in_data = response.json()["data"]
#
#     x_axis = ""
#     data1 = ""
#     data2 = data3 = ""
#
#     for x in in_data:
#         x_axis += x[0] + ","
#         data1 += x[7] + ","
#         data2 += x[3] + ","
#         data3 += x[4] + ","
#
#     return{
#         "title1": "日产气量",
#         "yname1": "万方",
#         "lname1": "",
#         "data1": data1[:-1],
#         "title2": "压力",
#         "yname2": "MPa",
#         "lname2": "生产压力,输压",
#         "data2": data2[:-1] + ";" + data3[:-1],
#         "x_axis": x_axis,
#     }

#分区模型预测曲线
# import requests
# def main(cookie: str,jh: str):
#     url = f"http://10.84.4.74/yyqer/ycyj/scycyj/mxdjyc_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#     yfs1 = response.json()["yfs1"]
#     yfs2 = response.json()["yfs2"]
#
#     x_axis = ""
#     data1 = ""
#
#     for x in yfs1:
#         x_axis += x + ","
#     for x in yfs2:
#         data1 += x + ","
#
#     return{
#         "title1": "分区模型预测曲线",
#         "yname1": "预测",
#         "lname1": "",
#         "data1": data1[:-1],
#         "x_axis": x_axis,
#     }

# #生产趋势分析
# import requests
# def main(cookie: str,jh: str):
#     url = f"http://10.84.4.74/yyqer/ycyj/kfqsfx/qsfx_json.jsp?jh={jh}&field=rcql/10000&model=调和递减&xcroo=rq&yclen=365"
#     response = requests.get(url, headers={"cookie": cookie})
#     mx = response.json()["mx"]
#     mx = mx[-1000:]
#     y = response.json()["y"]
#     y = y[-1000:]
#     ycrq = response.json()["ycrq"]
#     ycrq = ycrq[-1000:]
#     x_axis = ""
#     data1 = ""
#     data2 = ""
#
#     for x in ycrq:
#         x_axis += x + ","
#     for x in y:
#         data1 += str(x) + ","
#     for x in mx:
#         data2 += str(round(x,4)) + ","
#
#     return{
#         "title1": "生产趋势分析曲线",
#         "yname1": "日产气量",
#         "lname1": "日产气量,调和递减",
#         "data1": data1[:-1] + ";" + data2[:-1],
#         "x_axis": x_axis[:-1],
#     }
#单双线性流法预测
# import requests
# def main(cookie: str,jh: str):
#     url = f"http://10.84.4.74/yyqer/ycyj/scycyj/dsxxldfyc_json.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#     list1 = response.json()["list1"]
#     list2 = response.json()["list2"]
#     list3 = response.json()["list3"]
#     list4 = response.json()["list4"]
#     list5 = response.json()["list5"]
#     list6 = response.json()["list6"]
#     list7 = response.json()["list7"]
#     x_axis1 = data1 = data2 = ""
#     x_axis2 = data3 = data4 = ""
#     x_axis3 = data5 = data6 = data7 = ""
#
#     for x in list1:
#         x_axis1 += x[0] + ","
#         data1 += x[1] + ","
#     for x in list2:
#         data2 += x[1] + ","
#     for x in list3:
#         x_axis2 += x[0] + ","
#         data3 += x[1] + ","
#     for x in list4:
#         data4 += x[1] + ","
#     for x in list5:
#         x_axis3 += x[0] + ","
#         data5 += x[1] + ","
#     for x in list6:
#         data6 += x[1] + ","
#     for x in list7:
#         data7 += x[1] + ","
#     return{
#         "title1": "",
#         "yname1": "累产(万方)",
#         "lname1": f"{jh},双线性流",
#         "data1": data1[:-1] + ";" + data2[:-1],
#         "x_axis1": x_axis1[:-1],
#         "title2": "",
#         "yname2": "累产(万方)",
#         "lname2": f"{jh},单线性流",
#         "data2": data3[:-1] + ";" + data4[:-1],
#         "x_axis2": x_axis2[:-1],
#         "title3": "",
#         "yname3": "日产(万方/天)",
#         "lname3": f"{jh},双线性流,单线性流",
#         "data3": data5[:-1] + ";" + data6[:-1] + ";" + data7[:-1],
#         "x_axis3": x_axis3[:-1],
#     }

#运行表
# import requests
# from datetime import datetime
# def main(cookie: str):
#     nd = datetime.now().strftime("%Y")
#     url = f"http://10.84.4.74/yyqer/dtjc/sjtj/sjtj_yxball_json.jsp?nd={nd}"
#     response = requests.get(url, headers={"cookie": cookie})
#     in_data = response.json()["data"][:-1]
#
#     x_axis = ""
#     data1 = ""
#     data2 = ""
#     data3 = ""
#     data4 = ""
#     data5 = ""
#     data6 = ""
#     data7 = ""
#     data8 = ""
#
#     for x in in_data:
#         x_axis += x[0] + ","
#         data1 += x[1] + ","
#         data2 += x[2] + ","
#         data3 += x[3] + ","
#         data4 += x[4] + ","
#         data5 += x[5] + ","
#         data6 += x[6] + ","
#         data7 += x[7] + ","
#         data8 += x[8] + ","
#
#     return{
#         "title1": "流压",
#         "yname1": "次数",
#         "lname1": "",
#         "data1": data1[:-1],
#         "title2": "静压",
#         "yname2": "次数",
#         "lname2": "",
#         "data2": data2[:-1],
#         "title3": "产能试井",
#         "yname3": "次数",
#         "lname3": "",
#         "data3": data3[:-1],
#         "title4": "压力恢复",
#         "yname4": "次数",
#         "lname4": "",
#         "data4": data4[:-1],
#         "title5": "产剖测试",
#         "yname5": "次数",
#         "lname5": "",
#         "data5": data5[:-1],
#         "title6": "气分析",
#         "yname6": "次数",
#         "lname6": "",
#         "data6": data6[:-1],
#         "title7": "水分析",
#         "yname7": "次数",
#         "lname7": "",
#         "data7": data7[:-1],
#         "title8": "气质分析",
#         "yname8": "次数",
#         "lname8": "",
#         "data8": data8[:-1],
#         "x_axis": x_axis,
#     }

# 单井测压
# import requests
# def main(cookie: str,jh: str):
#     url = f"http://10.84.4.74/yyqer/dtjc/yljc/yl_lsqx_sj.jsp?jh={jh}"
#     response = requests.get(url, headers={"cookie": cookie})
#     x = response.json()["x"]
#     ys = response.json()["ys"]
#
#     x_axis = ""
#     data1 = data2 = ""
#
#     for x in x:
#         x_axis += x + ","
#     for x in ys[0]:
#         data1 += x + ","
#     for x in ys[1]:
#         data2 += x + ","
#
#     return{
#         "title1": "气层中部压力历史曲线",
#         "yname1": "压力、月产气量",
#         "lname1": "压力,月产气量",
#         "data1": data1[:-1] + ";" + data2[:-1],
#         "x_axis": x_axis,
#     }

#产剖测试
# import requests
# # def main(cookie: str,jh: str):
# #     url = f"http://10.84.4.74/yyqer/dtjc/fdqs/fdqs_db_json.jsp?jh={jh}&rqzd=2022-11-14,6万;2022-11-14,8万;"
# #     response = requests.get(url, headers={"cookie": cookie})
# #     in_data = response.json()["data"]
# #     rqzds = response.json()["rqzds"]
# #
# #     x_axis = ""
# #     title = ""
# #     data1 = data2 = ""
# #     data3 = data4 = ""
# #     data5 = data6 = ""
# #     data7 = data8 = ""
# #     for x in in_data[0]:
# #         x_axis += x[0] + ","
# #         data1 = x[2] + ","
# #         data3 = x[4] + ","
# #         data5 = x[1] + ","
# #         data7 = x[3] + ","
# #     for x in in_data[1]:
# #         data2 = x[2] + ","
# #         data4 = x[4] + ","
# #         data6 = x[1] + ","
# #         data8 = x[3] + ","
# #     return{
# #         "title1": "各段产气曲线",
# #         "yname1": "",
# #         "lname1": "2022-11-14,6万,2022-11-14,8万",
# #         "data1": data1[:-1] + ";" + data2[:-1],
# #         "title2": "各段产水曲线",
# #         "yname2": "",
# #         "lname2": "2022-11-14,6万,2022-11-14,8万",
# #         "data2": data3[:-1] + ";" + data4[:-1],
# #         "title3": "各段产气比曲线",
# #         "yname3": "",
# #         "lname3": "2022-11-14,6万,2022-11-14,8万",
# #         "data3": data5[:-1] + ";" + data6[:-1],
# #         "title4": "各段产水比曲线",
# #         "yname4": "",
# #         "lname4": "2022-11-14,6万,2022-11-14,8万",
# #         "data4": data7[:-1] + ";" + data8[:-1],
# #         "x_axis": x_axis,
# #     }
# # res = main("userName=wlx2023.jhyt; password=; JSESSIONID=1E83100466D1138BC4DD3269CB806194","焦页2HF")
# # print(res)

# problem_classification = [
#     ["日措施动态，包含：措施、井数(口)、药剂、药剂用量。"
#      ,"1"],
#     ["泡排井跟踪，包含：起泡剂、消泡剂、起泡剂配液浓度、起泡剂加注时间、起泡排量。"
#     ,"2"],
#     ["循环气举井跟踪，包含：集气站、循环气举井产气量、循环气举井产水量、循环气举井数、平台总气量、平台总水量、平台总井数、注入气量、产出与注入、气举时长、\
#     助推时长、助推水量、放空时长、放空气量、放空水量、是否在运行。"
#     ,"3"],
#     ["油管完井管柱数据，包含：油管内径、油管外径、油管壁厚、油管钢级、油管扣型、完井管柱结构、完井管柱下入深度、完井管柱底部位置(井斜角)、开工日期、\
#     完工日期、施工周期、施工单位、油管生产厂家、下管作业方式、投产日期、投产与下油管间隔天数、下管前一天套压、下管前一天日产气量。"
#     ,"4"],
#     ["检管，包含：检管时间、压井液量、检管后日均产气、检管后日均产水、检管后累产气、检管后累产水、区间产气、区间产水。"
#     ,"5"],
#     ["气举统计，包含：区块、管理区、施工开始时间、施工结束时间、气举天数、措施开始时间、措施截止时间、AB靶点垂深差、平均水气比、气举前油压、气举前套压、\
#     措施有效天数、措施前一周日均产气、措施后一周日均产气、措施前一周生产时率、措施后一周生产时率、措施阶段累产气。"
#     ,"6"],
#     ["泡排统计，包含：区块、管理区、措施开始时间、措施截止时间、AB靶点垂深差、平均水气比、是否运行、停运原因、当日产气量、前一日产气量、产量对比、\
#     月生产时率、措施有效天数、措施前日均产气、措施后日均产气、措施前平均生产时率、措施后平均生产时率、措施前平均油套压差、措施后平均油套压差、\
#     措施阶段平均日产气、措施阶段累产气、措施阶段增产气量。"
#     ,"7"],
#     ["柱塞统计，包含：区块、管理区、措施开始时间、措施截止时间、AB靶点垂深差、平均水气比、卡定器下深、开关井制度、油管尺寸、当日产气量、前一日产气量、\
#     产量对比、月生产时率、措施有效天数、措施前日均产气、措施后日均产气、措施前平均生产时率、措施后平均生产时率、措施前平均油套压差、措施后平均油套压差、\
#     措施阶段平均日产气、措施阶段累产气、措施阶段增产气量。"
#     ,"8"],
#     ["智能间开统计，包含：区块、管理区、措施开始时间、措施截止时间、AB靶点垂深差、平均水气比、当日产气量、前一日产气量、产量对比、月生产时率、措施有效天数、\
#     措施前日均产气、措施后日均产气、措施前平均生产时率、措施后平均生产时率、措施前平均油套压差、措施后平均油套压差、措施阶段平均日产气、措施阶段累产气、\
#     措施阶段增产气量。"
#     ,"9"],
#     ["管网气气举统计，包含：区块、管理区、措施开始时间、措施截止时间、AB靶点垂深差、平均水气比、当日产气量、前一日产气量、产量对比、月生产时率、措施有效天数、\
#     措施前日均产气、措施后日均产气、措施前平均生产时率、措施后平均生产时率、措施前平均油套压差、措施后平均油套压差、措施阶段平均日产气、措施阶段累产气、\
#     措施阶段增产气量。"
#     ,"10"],
#     ["电潜泵统计，包含：区块、管理区、措施开始时间、措施截止时间、AB靶点垂深差、平均水气比、当日产气量、前一日产气量、产量对比、月生产时率、措施有效天数、\
#     措施前日均产气、措施后日均产气、措施前平均生产时率、措施后平均生产时率、措施前平均油套压差、措施后平均油套压差、措施阶段平均日产气、措施阶段累产气、\
#     措施阶段增产气量。"
#     ,"11"],
#     ["射流泵统计，包含：区块、管理区、措施开始时间、措施截止时间、AB靶点垂深差、日均注水量、平均泵压、平均水气比、当日产气量、前一日产气量、产量对比、月生产时率、\
#     措施有效天数、措施前日均产气、措施后日均产气、措施前平均生产时率、措施后平均生产时率、措施前平均油套压差、措施后平均油套压差、措施阶段平均日产气、措施阶段累产气、\
#     措施阶段增产气量。"
#      ,"12"],
#     ["抽油机统计，包含：措施类型、开始时间、截止时间、折算措施费用、措施期、累计产气、累计产水、日均产气、日均产水、生产小时、总耗电量、电流、冲程、冲次、\
#     措施有效率、措施回收期。"
#      ,"13"],
#     ["循环气举统计，包含：区块、管理区、措施开始时间、施截止时间、该阶段是否循环气举、区间产气量、区间产水量、区间生产时率、区间平均油套压差。"
#      ,"14"],
#     ["措施经济评价，包含：措施类型、井口数、作业次数、区间天数、折算措施费用、累计产气、折算产气价值、有效作业次数、区块。"
#     ,"15"],
#     ["加注制度，包含：加注类型、共用流程、起泡剂配液浓度、起泡剂起泡排量、起泡剂理论加药量、消泡剂配液浓度、消泡剂起泡排量、消泡剂理论加药量、备注、制度调整情况。"
#     ,"16"],
#     ["药剂库存台账，包含：上传日期、起泡剂库存、消泡剂库存、缓蚀杀菌剂库存、起泡剂厂家、消泡剂厂家、缓蚀杀菌剂厂家、经办人。"
#      ,"17"],
#     ["集气站领料,转运台账，包含：日期、领料/转运类型、药剂种类、厂家、生产时间、数量、经办人、备注。"
#      ,"18"],
#     ["需求计划台账，包含：管理区、提报时间、需求计划名称、起泡剂计划、消泡剂计划、药剂厂家、备注。"
#      ,"19"],
#     ["泡排泵撬台账，包含：投产日期、泡排投运时间、是否有加药流程、泵撬类型、加注类型、泵功率(kw)、厂家、共用流程、是否长期停运、长期停运原因、辅助工艺。"
#      ,"20"],
#     ["效果分析，包含：前一日套压、前一日油压、前一日油套压差、前一日气产量、前一日水产量、前一日水气比、前一日生产时率、当日套压、当日油压、当日油套压差、\
#     当日气产量、当日水产量、当日水气比、当日生产时率、套压变化、油压变化、油套压差变化、气产量变化、水产量变化、水气比变化、生产时率变化。"
#      ,"21"],
#     ["药剂经营分析，包含：上月日均产水量、理论日均起泡剂加注量、理论日均消泡剂加注量最小值、理论日均消泡剂加注量最大值、理论月度起泡剂加注量、\
#     理论月度消泡剂加注量最小值、理论月度消泡剂加注量最大值、实际起泡剂消耗量、实际消泡剂消耗量、▲起泡剂、▲消泡剂最小值、▲消泡剂最最值。"
#      ,"22"],
#     ["异常预警，包含：采气区、初步判断、排查方法、措施建议、生产方式、油管外径、油管壁厚、中部深度、油管内径、油管下深、B-A垂深差、套压、油压、\
#     日产气、日产水、实际油套压差、合理油套压差、计算井底流压、临界携液流量、备注。"
#      ,"23"],
#     ["异常井分析，包含：日期、生产时间、套压、油压、输压、温度、井口气日产量、放空气日产量、水日产量、油日产量、油日产量、井口气月产量、水月产量、\
#     油月产量、油月产量、井口气年产量、水年产量、油年产量、油年产量、井口气累产量、工业气累产量、水累产量、油累产量、累月产量、起泡剂、消泡剂、\
#     缓蚀杀菌剂、生产自用气、表套、技套、流压、备注。"
#      ,"24"],
#     ["井筒积液风险判别，包含：30天均日产气、30天均日产水、30天均气水比、30天日产气变化率、30天日产水变化率、30天气水比变化率、当天油套压差、\
#     当天油压、30天油套压差变化率、30天油压变化率。"
#      ,"25"],
#     ["增压识别预警，包含：生产时间、套压、油压、输压、井口气日产量、水日产量、投产日期、气井分类、增压识别。"
#      ,"26"],
#     ["气井免修期，包含：投产日期、下油管日期、下连油日期、检管开始日、检管结束日、免修期起、免修期止、免修期、免修期。"
#      ,"27"],
#     ["井下作业施工时间，包含：井号、投产日期、检管开始日、检管结束日、检管时间。"
#      ,"28"],
#     ["施工一次合格率"
#      ,"29"],
#     ["施工全优率"
#      ,"30"],
#     ["返工率"
#      ,"31"],
#     ["资料全准率"
#      ,"32"],
#     ["采气时率,采气指标，包含：前一日区间水气比、前一日生产时率、今日区间水气比、今日生产时率。"
#      ,"33"],
#     ["水淹关停率，包含：最大连续关井天数。"
#      ,"34"],
#     ["躺井率，包含：躺井类型、井号、区块、管理区、躺井时长。"
#      ,"35"],
#     ["措施统计，包含：措施类型、实施井数、实施井次、百万方产气量措施成本。"
#      ,"36"],
#     ["工艺汇总表，包含：类型、项目、焦石坝、江东、平桥、白马、复兴、红星、建南、合计。"
#      ,"37"],
#     ["油管穿孔，包含：油管外径、油管壁厚、下管日期、油管厂家、检管日期、穿孔油管根数、穿孔点数量、腐蚀状况、检管间隔天数。"
#      ,"38"],
#     ["油管探伤，包含：日期、井号、油管数据、油管尺寸、合格数、不合格数、合格率、检测人、备注。"
#      ,"39"],
#     ["老井产量基数，包含：投产时间、生产阶段1月到12月。"
#      ,"40"],
#     ["措施增量汇总，包含：措施类型、年计划实施井次、实际实施井次、年计划增气量、年实际增气量。"
#      ,"41"],
#     ["措施评价，包含：措施类型、措施开始时间、措施截止时间、措施期、措施期老井产量基数、措施前一个月产量、措施期日均产气、措施日增气量、措施累计增气量。"
#      ,"42"],
#     ["低效治理效果，包含：全年基数、全年措施计划、全年实际产量、全年计划增量、全年实际增量。"
#      ,"43"],
#     ["地面集气设备统计表，采气树统计表，包含：生产厂家、材料级别、型号、生产编号、安装日期。"
#      ,"44"],
#     ["气举阀，包含：下管日期、投捞日期、油管尺寸、油管底下深、工作筒规格、工作筒外径、工作筒通径、气举阀级数、气举阀下深、启动压力、地面打开压力、\
#     地面关闭压力、气举阀压力等级、气举阀厂家、类型、备注。"
#      ,"45"],
#     ["井下油管，包含：管柱编号、管串名称、内径、外径、壁厚、钢级、扣型、长度、下深、厂家、备注。"
#      ,"46"],
#     ["联络阀，包含：络阀名称、联络阀位置、联络管线、开关情况。"
#      ,"47"],
#     ["固井解释,固井质量数据，包含：解释序号、顶深、底深、一界面解释结论、二界面解释结论、解释单位、备注。"
#      ,"48"],
#     ["机抽井基础台账，包含：采气区、中心站/巡检站、A靶点斜深、A靶点垂深、B靶点斜深、B靶点垂深、AB靶点垂深差、水平段形态、转抽日期、作业次数、上次完井开抽日期、\
#     目前检泵周期、备注、日均产气、有无增压、泵径、泵深、泵深井斜角、冲程、冲次、最深动液面、最大功图载荷、最小功图载荷、泵型、抽油机型、防爆电机。"
#      ,"49"],
#     ["钻头程序,套管程序，包含：导管钻头程序外径、导管钻头程序井深、导管套管程序外径、导管套管程序壁厚、导管套管程序下深、一开钻头程序外径、一开钻头程序井深、\
#     一开套管程序外径、一开套管程序壁厚、一开套管程序下深、二开钻头程序外径、二开钻头程序井深、二开套管程序外径、二开套管程序壁厚、二开套管程序下深、\
#     三开钻头程序外径、三开钻头程序井深、三开套管程序外径、三开套管程序壁厚、三开套管程序下深。"
#      ,"50"],
#     ["接箍数据，包含：油层套管序号、单根长、套管接箍深度、备注。"
#      ,"51"],
# ]

# problem_classification = [
#     ["运行表，包含：年月、流压、静压、产能试井、压力恢复、产剖测试、气分析、水分析、气质分析、合计。"
#      ,"1"],
#     ["测压计划表，包含：井号、投产日期、描述、频率、最近测试日期。"
#      ,"2"],
#     ["单井测压数据，包含：层位、测试目的、测压日期、套压、油压、气产量、井口温度、仪器型号及编号、仪器量程、仪器精度、井深m、垂深m、压力、\
#     压力梯度、温度、温度梯度、气层中部深度、液面深度、气层中部压力、压力系数、备注。"
#      ,"3"],
#     ["测液面，包含：、油管内径、油管外径、完井管柱下入深度、完井管柱底部位置(井斜角)、测试日期、仪器型号、套压、油压、产气量、气层中部深度、\
#     液面深度、液面垂深、压力计下入井深、测压液面深度、推算静压、备注、测试单位。"
#      ,"4"],
#     ["水分析,溶液离子，包含：管理区、层位、井段顶深、井段底深、样品编号、样品描述、分析人、审核人、取样日期、分析日期、分析类型、PH值、水相对密度、\
#     阳离子[锂离子、钾离子、钠离子、钾钠离子、铵根离子、钙离子、镁离子、钡离子、锶离子]、阳离子总值、阴离子[氟离子、氯离子、溴离子、碘离子、硝酸根离子、\
#     硫酸根离子、碳酸氢根离子、碳酸根离子、氢氧根离子]、阴离子总量、总矿化度、水型、备注、投产日期、累产天数、累产气量、累产水量、取样单位、取样人、取样部位。"
#      ,"5"],
#     ["气质分析，包含：名称、样品编号、取样日期、取样单位、取样位置、取样人、分析人、审批人、分析日期、高位发热量、硫化氢、总硫、历年最低环境温度、\
#     管输压力、露点、二氧化碳、检测结论、检测单位、备注。"
#      ,"6"],
#     ["同位素，包含：井号、生产井段、层位、取样日期、取样部位、取样压力、CH₄气体组分摩尔、C₂H₆气体组分摩尔、C₃H₈气体组分摩尔、CO₂气体组分摩尔、\
#     N₂气体组分摩尔、摩尔数之和、气体组分摩尔-干燥系数、δC13‰-CH₄、δC13‰-C₂H₆、δC13‰-C₃H₈、δC13‰-iC₄、δC13‰-nC₄、投产日期。"
#      ,"7"],
#     ["细菌，包含：井号、层位、井段顶深、井段底深、样品编号、颜色、嗅、沉淀情况、透明度、取样单位、取样人、取样位置、取样日期、分析日期、\
#     分析人、审核人、腐生菌、硫酸盐还原菌、铁细菌、备注。"
#      ,"8"],
#     ["溶液水，包含：井号、样品编号、取样单位、取样人、取样位置、分析人、审核人、取样日期、分析日期、水质量分数浓度、备注。"
#      ,"9"],
#     ["产剖测试，包含：段、斜深1、斜深2、垂深1、垂深2、各级产水量、各簇产水量、各簇产水量占百分比、各级产水量占百分比、各级产气量、各簇产气量、\
#     各簇产气量占百分比、各级产气量占百分比、簇内平均温度、簇内平均压力。"
#      ,"10"],
#     ["压力恢复测试，包含：井号、关井前气产量、关井前水产量、关井时刻油压、关井时刻套压、关井时刻井底流压、关井时刻最高恢复压力、开井阶段累计产气量、\
#     开井阶段生产时间、关井时间、备注。"
#      ,"11"],
#     ["微注入测试，包含：井号、测试时间、测试单位、层位、射孔井段深度、测试层位、压力计位置、仪器型号及编号、压力计精度、压力计量程、压力计数量、\
#     注入排量、注入量、施工压力、停泵压力、最终关井井口压力、总关井时间、备注。"
#      ,"12"],
#     ["压力汇总，包含：井号、层位、测试目的、测压日期、套压、油压、气产量、测压日产水量、测压日累产气量、测压日累产水量、井口温度、气层中部深度、\
#     液面深度、气层中部压力、气层中部温度、气层中部压力/井口套压、最大压力梯度、压力系数、区块、测试单位、备注。"
#      ,"13"],
#     ["气分析，包含：管理区、井号、层位、井段顶深、井段底深、样品编号、样品描述、取样单位、取样人、取样部位、分析人、审核人、取样日期、化验日期、\
#     相对密度、临界温度、临界压力、摩尔质量、压缩因子、硫化氢、二氧化碳、氦气、氢气、氮气、二氧化碳、硫化氢、甲烷、乙烷、丙烷、异丁烷、正丁烷、异戊烷、\
#     正戊烷、己烷、备注、投产日期、累产天数、累产气量、累产水量。"
#      ,"14"],
#     ["油分析，包含：层位、井段顶深、井段底深、样品编号、颜色、嗅、沉淀情况、透明度、取样单位、取样人、取样位置、取样日期、测试日期、水含量、标准密度、\
#     投产日期、累产天数、累产气量、累产油量、累产水量、备注。"
#      ,"15"],
#     ["油组分析，包含：层位、样品类型、取样位置、取样日期、分析日期、分析单位、C1、C2、C3、C4、C5、C6、C7、C8、C9、C10、C11、C12、C13、C14、C15、\
#     C16、C17、C18、C19、C20、C21、C22、C23、C24、C25、C26、C27、C28、C29、C30、C31、C32、C33、C34、C35、C36、C37、C38、C39、C40、C41、C42、\
#     C43、Pr、Ph、甲基环已烷指数、环已烷指数、苯指数、环烷指数、庚烷值、石蜡指数、OEP值、Pr/Ph、Pr/n-C17、Ph/n-C18、(C21+C22)/(C28+C29)、\
#     ∑C21-/∑C22+、投产日期、累产天数、累产气量、累产油量、累产水量、备注。"
#      ,"16"],
#     ["刮蜡数据，包含：井号、刮蜡日期、套压、油压、刮蜡深度、刮蜡量、刮蜡时长、备注。"
#      ,"17"],
#     ["微地震监测，包含：压裂段、穿行层位、微地震事件数目、西翼裂缝网络长、东翼裂缝网络长、裂缝网络总长度、西翼裂缝网络宽、东翼裂缝网络宽、裂缝网络平均宽度、\
#     裂缝网络长宽比、裂缝网络高度、裂缝网络走向、储层改造体积、监测距离。"
#      ,"18"],
#     ["开发现状，包含：井号、生产压力、外输压力、产气量、产水量、水气比。"
#      ,"19"],
#     ["生产指标，包含：日期、总井数、开井数、老井日产气、新井日产气、老井日产水、新井日产水、套压、油压、输压、新井套压、新井油压、老井套压、老井油压。"
#      ,"20"],
#     ["产能指标，包含：井号、动用储量、技术可采储量、剩余技术可采储量、动用储量采出程度、技术可采储量采出程度、动用储量采气速度、技术可采储量采气速度、\
#     剩余可采储量采气速度、区块产能、产能负荷因子、总水气比、储采比、单位压降产量、自然递减率、套压同比压降值、油压同比压降值。"
#      ,"21"],
#     ["产能与储量信息，报包含：井号、单井产能方案设计值、新建产能方案设计值、单井技术可采储量方案设计值、单井动用面积、实际单井动用储量、单井动用地质储量、\
#     新建产能核定标定年份、新建产能核定单井产能、新建产能核定保有产能、新建产能核定新建产能、2023年底标定值单井技术可采储量、2023年底标定值单井经济可采储量。"
#      ,"22"],
#     ["区块产销情况，包含：日期、天数、产量、销量、日产量、日销量、同比产量、同比销量、产油量、销售油量、日产油、日销油、同比产油量、同比销油量。"
#      ,"23"],
#     ["区块计划对比、计划完成情况，包含工作目标、奋斗目标、实际生产。"
#      ,"24"],
#     ["日产量对比，今天和昨天的产量变化，包含、井号、昨日气产量、今日气产量、气产量变化。"
#      ,"25"],
#     ["压力分析，不同压力下的产量，包含：井号、压力大于或等于10MPa时日产、压力大于或等于10MPa时累产、压力小于10MPa时日产、压力小于10MPa时累产、\
#     压力大于或等于7MPa时日产、压力大于或等于7MPa时累产、压力小于7MPa时日产、压力小于7MPa时累产、10MPa到9MPa时日产、10MPa到9MPa时累产、\
#     9MPa到8MPa时日产、9MPa到8MPa时累产、8MPa到7MPa时日产、8MPa到7MPa时累产、7MPa到6MPa时日产、7MPa到6MPa时累产、6MPa到5MPa时日产、\
#     6MPa到5MPa时累产、5MPa到目前时日产、5MPa到目前时累产。"
#      ,"26"],
#     ["气田产量，包含：日期、一区流量、二区流量、三区流量、四区流量、合计。"
#      ,"27"],
#     ["集气站产量，包含：集气站、8点产量、9点产量、10点产量、11点产量、12点产量、13点产量、14点产量、15点产量、16点产量、17点产量、\
#     18点产量、19点产量、20点产量。"
#      ,"28"],
#     ["气田销量，包含：日期、乌江北销量、乌江南销量、白马销量、平桥销量、合计。"
#      ,"29"],
#     ["实时预警，包含：井号、最小压力、最大压力、压力波动幅度、最小输压、最大输压、输压波动幅度。"
#      ,"30"],
#     ["井筒积液预警，包含：井号、水气比、产气量、油压、压差、合理压差、油管内径、结果。"
#      ,"31"],
#     ["临界携液流量，包含：李闽模型临界携液流量、Turner模型临界携液流量、振荡模型临界携液流量、连续排液产量、管柱冲蚀流量。"
#      ,"32"],
#     ["低压预警，包含：井号、日产气量、日产水量、油压、套压、油套压差、前日油套压差、生产压力、输压、生产压力输压差、累水气比、水气比、累产气、携液流量、预警。"
#      ,"33"],
#     ["间开井提示，包含：井号、日产气、日度产量波动、小时产量波动、气井分类、套压、油压、油套压差、日产气、日产水、水气比、上一间开制度、上上间开制度、\
#     日产气、日产水、油套压差、对策、是否需要调整。"
#      ,"34"],
#     ["产量异常提示，包含：井号、生产时间、套压、油压、输压、产气量、水量、压力基数、产量基数、压力变化、产量变化、备注。"
#      ,"35"],
#     ["小时级积液预警，包含：井号、管理区、前2小时油压、前2小时套压、前2小时产气量、前1小时油压、前1小时套压、前1小时产气量、当前油压、当前套压、当前产气量。"
#      ,"36"],
#     ["单井调产管理，包含：井号、开采方式、生产时间、套压、油压、输压、当前井口气日产量、合理配产、最大配产、提产能力、备注、出砂量。"
#      ,"37"],
#     ["躺井管理，包含：井号、日均套压、日均油压、日均产气量、日均产水量、区间气累产量、区间水累产量、采气指标区间水气比、采气指标区间生产时率、\
#     最大连续关井天数、状况。"
#      ,"38"],
#     ["关停井影响产量分析，包含：井号、最近连续关井天数、影响产量、备注。"
#      ,"39"],
#     ["气井分类，包含：井号、生产时间、套压、油压、井口气日产量、放空气日产量、水日产量、投产日期、生产时率、气井分类、气井分类2、备注。"
#      ,"40"],
#     ["生产时率，包含：区块、生产时率。"
#      ,"41"],
#     ["产量波动异常，包含：井号、集气站、管理区、生产压力、日产气。"
#      ,"42"],
#     ["重点井报表，包含：类型、井号、套压、油压、井口气日产量、放空气日产量、水日产量、油日产量、油日产量。"
#      ,"43"],
# ]
# problem_classification = [
#     ["与邻井对比、与相似井对比，包含：平段长、垂深范围、平均垂深、粘土矿物范围、平均黏土矿物、地层密度方位、平均底层密度、含气饱和度范围、平均含气饱和度、\
#     类型、距离、无阻流量。"
#      ,"1"],
#     ["脆性矿物含量统计，包含：测试日期、层位、顶深、底深、距顶、岩性、黏土质量、硬石膏含量、方沸石含量、石英含量、钾长石含量、斜长石含量、方解石含量、\
#     铁白云石含量、白云石含量、菱铁矿含量、无水芒硝含量、黄铁矿含量、石盐含量、钙芒硝含量、石膏含量、重晶石含量、浊沸石含量。"
#      ,"2"],
#     ["粘土矿物数据，包含：测试日期、层位、顶深、底深、距顶、岩性、黏土总量、伊/蒙间层相对含量、伊/蒙间层绝对含量、伊利石(I)相对含量、伊利石(I)绝对含量、\
#     高岭石(K)相对含量、高岭石(K)绝对含量、绿泥石(C)相对含量、绿泥石(C)绝对含量、间层比(%S)I/S。"
#      ,"3"],
#     ["聚类分析，包含：垂深、粘土矿物、含气饱和度、破裂压力、聚类结果、顶界深度、底界深度。"
#      ,"4"],
#     ["人工评价、机器评价、推荐评价、人机交互评。"
#      ,"5"],
#     ["G函数裂缝面积，包含：段号、单段液量、杨氏模量、泊松比、体积模量、簇数、瞬时停泵压力ISIP、闭合压力(G函数)、闭合压力(G函数)、闭合特征dp/dG(G函数)p*(psi)、\
#     闭合特征dp/dG(G函数)p*(MPa)|缝高、泵注时间tp、主裂缝半长、主裂缝面积Afm、天然裂缝面积A_fm、总裂缝面积A_fm、复杂度、闭合次数、G函数分型。"
#      ,"6"],
#     ["压裂液摩阻，包含：射孔中深、管柱内径、停前排量、停前压力、ISIP、千米摩阻、减阻率。"
#      ,"7"],
#     ["设计符合率，包含：段号、设计加砂量、实际加砂量、加砂量完成率、设计液量、实际液量、液量完成率、设计粘度、实际粘度、粘度偏差、设计排量、\
#     实际平均排量、排量实际占比、裂缝半长目标值、裂缝半长计算值、裂缝半长比目标值。"
#      ,"8"],
#     ["施工质量评分结果，包含：压裂段序号、停泵次数、砂堵次数、主裂缝半长、G函数闭合次数、G函数分型、曲线形态、净压力超两向应力差时长占比、暂堵前后两级压差、\
#     砂量符合率、液量符合率、粘度符合率、平均施工排量符合率、参数评价、曲线评价、压力评价、裂缝评价、设计主裂缝半长、主裂缝半长符合率、总评分。"
#      ,"9"],
#     ["压裂总览，包含在压井、异常动态、总览信息、待压井、试气井、本月开始压裂井数、本月完成压裂井数、本月完成试气井数、本年累计压裂井数、本年累计试气井数、\
#     本年累计完成压裂井数、本年累计完成试气井数。"
#      ,"10"],
#     ["钻井概况，导向井信息，包含：钻井队、井号、设计、实钻、钻达层位、当日、月累计、年累计、下部工序、钻机动态、工程简述、导向参照井、导向人员。"
#      ,"11"],
#     ["导向简况，包含下步导向简况。"
#      ,"12"],
# ]
# problem_classification = [
#     ["完井统计，包含：地理位置、开钻、完钻、完井、设计、实际、开始试气日期、结束试气日期、投产日期。"
#      ,"1"],
#     ["录井岩性，包含：顶深、底深、厚度、颜色、岩石名称、含油级别、备注。"
#      ,"2"],
#     ["气测数据，包含：钻时、全烃、甲烷、硫化氢、泥浆密度、泥浆粘度。"
#      ,"3"],
#     ["井漏动态，包含：漏失层位、顶深、底深、主要岩性、漏失原因、工程简况、漏失量、累计漏失量、平均漏速、钻井液密度、钻井液粘度、备注。"
#      ,"4"],
#     ["井斜数据，包含：井号测深、井斜角、方位角、垂深、南北分量、东西分量、闭合距、闭合方位、全角变化率。"
#      ,"5"],
#     ["气层统计，包含：水平段分类气层厚度1类、水平段分类气层厚度2类、水平段分类气层厚度3类、水平段分类气层厚度4类、水平段分类气层厚度干层、\
#     全井段分类气层厚度1类、全井段分类气层厚度2类、全井段分类气层厚度3类、全井段分类气层厚度4类、全井段分类气层厚度干层、A靶斜深、B靶斜深、\
#     水平段长、水平分类占比1类、水平分类占比2类、水平分类占比1+2类、最高测试压力、最高测试产量、无阻流量。"
#      ,"6"],
#     ["钻井大事纪要，钻井大事纪要包括：井漏数据、断钻具数据、遇阻遇卡、卡钻数据、溢流数据，其中井漏数据包含：日期、井深、漏失井段、厚度、漏失层位、\
#     漏失段主要岩性、漏失量、累计漏失量、平均漏速、相对密度、粘度、漏失原因、施工状态、处理情况、备注。断钻具数据包含：日期、井深、鱼顶位置、落鱼长度、\
#     钻头位置、落鱼结构、泵压变化、悬重变化、处理情况、备注。遇阻遇卡包含：日期、井深、层位、岩性、阻卡原因、悬重变化、处理情况、备注。卡钻数据包含：日期、\
#     井深、钻头位置、卡钻原因、处理情况、备注。溢流数据包含：日期、井深、钻头位置、钻井液静止时间、溢出物性质、外溢速度、外溢量、钻井液液量变化、钻井液性能变化、\
#     处理情况、备注。"
#      ,"7"],
#     ["套管数据，包含：套管类别、套管名称、下井序号、外径、内径、壁厚、单根长、累计长、下深、扣型、钢级、产地、备注。"
#      ,"8"],
#     ["分层数据，包含：层位、详细层位、斜深、斜厚、垂深。"
#      ,"9"],
#     ["测井解释，包含：层位、井段、厚度、测井参数、阵列感应、深侧向、声波、密度、中子、孔隙度、渗透率、含气饱和度、TOC、解释结果、备注。"
#      ,"10"],
#     ["二次解释，包含：解释类别、层号、层位、井段、厚度、GR、AC、DEN、CNL、RT、RS、PORZ、PORY、JZK、TOC、SW、VXF、VYL、VZ、VSY、解释结果、解释单位、备注。"
#      ,"11"],
#     ["固井质量，包含：顶深、底深、一界面解释结论、二界面解释结论、解释单位、备注。"
#      ,"12"],
#     ["缝隙解释成果，包含：作业井号、测试井号、层号、深度1、深度2、厚度、纵波时差、横波时差、横纵波时差比、密度、泊松比、杨氏模量、体积模量、切变模量、\
#     裂缝指数、破裂压力、出砂指数、斯伦贝尔比、层位或小层、脆性指数、解释结论、备注。"
#      ,"13"],
#     ["地应力分析成果，包含：作业井号、测试井号、深度1、深度2、最大水平地应力、最小水平地应力、垂向应力、水平地应力差异系数、对应小层。"
#      ,"14"],
#     ["多特征对比，包含：参数、井组、对照、差值、比例。"
#      ,"15"],
#     ["井漏信息，包含：漏失井段、厚度、漏失层位、漏失层岩性、漏速、漏失量、累计漏失量、钻井液密度、钻井液粘度、漏失原因、工况简述。"
#      ,"16"],
#     ["单井基础数据,详细信息，包含：井号、井别、井型、地理位置、构造位置、钻探目的、井口复测坐标纵坐标、井口复测坐标横坐标、地面海拔、补心海拔、补心高、\
#     开钻日期、施工队号、完钻日期、完钻井深、完井日期、完井方式、人工井底、一开日期、二开日期、三开日期、油套阻位、井口层位、设计井深、完钻层位、备注、数据更新时间。"
#      ,"17"],
#     ["钻井信息，包含：区块、设计A点坐标纵坐标、设计A点坐标横坐标、设计B点坐标纵坐标、设计B点坐标横坐标、实钻A点坐标纵坐标、实钻A点坐标横坐标、实钻A点坐标斜深\
#     实钻A点坐标垂深、实钻B点坐标纵坐标、实钻B点坐标横坐标、实钻B点坐标斜深、实钻B点坐标垂深、水平段井段、水平段长度、投产日期、最高测试压力、最高测试产量、无阻流量。"
#      ,"18"],
# ]
# problem_classification = [
#     ["集气站异常，包含：集气站、穿孔时间、管件名称、穿孔点部位。"
#      ,"1"],
#     ["输差分析，包含：日期、总销售量、总输差、总输差、一与二与三区销售合计、一与二与三区工业气、一与二与三区输差、一与二与三区输差、四区销售合计、\
#     四区工业气、四区输差、四区输差、平桥区块工业气、凤来区块工业气、平桥+凤来输差、平桥+凤来输差、白马输差、白马输差。"
#      ,"2"],
#     ["措施优化，包含：日期、管线、清管器、清管时长、清除积液、清除杂质、清管前压差、清管后压差、产量提高、清管有效率。"
#      ,"3"],
#     ["腐蚀穿孔，包含：集气站号、支线、管线规格、管线材质、孔点部位、管件名称、站点温度、穿孔时间、穿孔所属段、穿孔段是否添加缓释、是否抗菌钢、备注。"
#      ,"4"],
#     ["细菌检测、抗菌钢、药剂统计、管壁厚度。细菌检测包含：集气站号、取样位置、取样日期、腐生菌、硫酸盐还原菌、铁细菌、备注。抗菌钢包含：集气站号、\
#     更换管线类型、更换部位、更换完成时间、药剂统计包含、井号、加注日期、日加注量。管壁厚度包含：名称、外径、壁厚、长度。"
#      ,"5"],
#     ["单井缓蚀杀菌剂加注制度，包含：集气站、井号、加注泵、加注泵编号、加注制度、加注点、值守方式、半月均出水量、日出水量、药剂罐容量、药剂稀释浓度、\
#     加注排量、加注时间、每次加注量、每次加注量。"
#      ,"6"],
# ]
# problem_classification =[
#     ["采气异常和异常状态的井，异常包括油管积液、水平段积液、油管堵塞、油套异常窜通；管输异常包含：起点站、末点站、压差；集气站异常包含：穿孔次数；\
#     产量信息、产量产量异常包含：产量上升和下降的井，也包含异常下降的信息；脱水站异常和脱水站的信息包含：压损。"
#      ,"1"],
#     ["涪陵公司、采气一厂、江汉油田的生产情况，生产动态信息，计划信息，产建动态，包含：总井数、开井数、开井率、产气量、新井产量、措施产量、自然产量、销售量、\
#     产油量、生产压力、影响产量、计划产气量、剩余日产水平、计划销售量、剩余日销水平、开钻、完钻、完井、完试、投产、正钻、正压、正试、新投、日进尺。"
#      ,"2"],
#     ["钻井日报，包含：施工单位、钻井队、设计井深、实际井深、目的层、钻达层位、钻头尺寸、钻井液类别、各次开钻时间、钻压、钻速、排量、泵压、密度、粘度、\
#     当日进尺、月度进尺、年累进尺、工况简述、下一步工序。"
#      ,"3"],
#     ["江汉油田产气量和销量计划，包含：月份、计划气量、实际产量、计划销售、实际销售。"
#      ,"4"],
#     ["单井试气日报，包含试气单位、队号、层位、设孔井段、厚度、层（段）数、开工时间、措施类型/工艺、施工简况、下一步工序。"
#      ,"5"],
#     ["生产日报，包含：公司、区块、管理区、井号、中心站、井站、层位、生产井段、开采方式、生产时间、套压、油压、井口气、放空气、水、油、油、起泡剂、\
#     消泡剂、缓蚀杀菌剂、输压、温度、生产自用气、表套、技套、孔板、氯根、油嘴、投产日期、备注。"
#      ,"6"],
#     ["区块日报，包含：日期、气田、区块、总井数、开井数、生产压力、套压、油压、输压、日产量井口气、日产量工业气、日产水、月产量井口气、月产量工业气、\
#     月产水、年产量井口气、年产量工业气、年产水、累产量井口气、累产量工业气、累产水、生产自用气。"
#      ,"7"],
# ]
problem_classification = [
    ["产销，分为日度产销曲线和年度产销曲线，"
     ,"1"],
    ["日度产量对比，包含：了自然产量曲线、措施产量曲线、新井产量曲线、总日产量曲线。"
     ,"2"],
    ["计划完成，包含：计划产气量、计划销售气量。"
     ,"3"],
    ["分段特征，包含全烃卷积、孔隙度卷积、有机碳卷积、破裂压力卷积。"
     ,"4"],
    ["生产总览，包含：月开始压裂井数、月完成试气井数、年开始压裂井数、年完成试气井数。"
     ,"5"],
    ["施工质量异常统计，包含：华美、江汉、胜利中原的施工质量异常统计。"
     ,"6"],
    ["压裂实时曲线，包含：累计砂量、累计液量、泵压、粘度、砂比、排量。"
     ,"7"],
    ["单井分析，包含：开井压力、酸降压力、破裂压力、停泵压力、延伸压力、液量、单簇液量、砂量、单簇砂量、延伸排量、支撑剂加量。"
     ,"8"],
    ["单井特征，包含：垂深卷积、脆性矿物卷积、含气饱和度卷积、破裂压力卷积。"
     ,"9"],
    ["G函数，包含：停泵后压力、GdP/dG。"
     ,"10"],
    ["设计符合率，包含：加砂量设计符合率、液量设计符合率。"
     ,"11"],
    ["综合产量，包含：日产气量、日产水量、水气比。"
     ,"12"],
    ["新老井产量构成，包含：老井自然产量、老井自然产量、新井产量。"
     ,"13"],
    ["分年产量构成，包含：焦石坝一期、焦石坝调整井、江东、平桥、白桃白马风来、新区新层系。"
     ,"14"],
    ["自然递减，包含：递减率。"
     ,"15"],
    ["分年日均产量构成。"
     ,"16"],
    ["区块日均产量构成，包含的区块有：白马、白涛、凤来、复兴、红星、江东加密、江东上部、江东原井网、焦石坝加密、焦石坝上部、焦石坝一期、\
    焦石坝中部、平桥加密平桥上部、平桥原井网。"
     ,"17"],
    ["开发现状，包含：生产压力分布、外输压力分布、产气量分布、产水量分布、水气比分布。"
     ,"18"],
    ["生产指标，包含：总井数、开井数、老井日产气、新井日产气、总产气量、老井日产水、新井日产水、总产水量、套压、油压、输压、新井套压、新井油压、老井套压、老井油压。"
     ,"19"],
    ["某一口井的生产曲线，包含：生产时间、套压、油压、日产气量、临界携液流量、日产水量。"
     ,"20"],
    ["涪陵气田生产曲线，包含：日产气量、生产压力、输压。"
     ,"21"],
    ["某一口井的时间归一化生产曲线，包含：日产气量、生产压力、输压。"
     ,"22"],
    ["涪陵气田时间归一化生产曲线，包含：日产气量、生产压力、输压。"
     ,"23"],
    ["某一口井的分区模型预测曲线。"
     ,"24"],
    ["某一口井的生产趋势分析，包含：日产气量、调和递减。"
     ,"25"],
    ["某一口井的单双线性流法预测，包含：双线性流、单线性流、累产预测、日产预测。"
     ,"26"],
    ["运行表，包含：流压次数、静压次数、产能试井次数、压力恢复次数、产剖测试次数、气分析次数、水分析次数、气质分析次数。"
     ,"27"],
    ["某一口井的测压曲线，包含：压力、月产气量。"
     ,"28"],
    ["某一口井的产剖测试曲线，包含：各段产气、各段产水、各段产气比、各段产水比。"
     ,"29"],
    ["油分析曲线，包含：标准密度、水含量。"
     ,"30"],
    ["水分析曲线，包含：PH、总矿化度、锂离子。"
     ,"31"],
    ["气分析曲线，包含：甲烷、乙烷、硫化氢。"
     ,"32"],
    ["微地震监测，包含：体积、高度、长度。"
     ,"33"],
    ["气田产量实时变化曲线，包含：一区产量、二区产量、三区产量、四区产量、气田实时产量。"
     ,"34"],
    ["井筒积液分析，包含：压力、垂深。"
     ,"35"],
    ["井筒积液趋势，包含：套压、油压、积液趋势、月产水量、月产气量、生产天数。"
     ,"36"],
    ["临界携液流量，包含：李闽模型产量、Turner模型产量、震荡模型产量。"
     ,"37"],
    ["气井分类构成，气井平均日产构成。"
     ,"38"],
    ["措施日度动态，包含：气举日度动态、移动气举井数、移动气举产气、循环气举井数、循环气举产气、泡排日度动态、加药井井数、加药井产气、运行井井数、运行井产气、\
    机抽日度动态、当日启抽井井数、当日启抽井产气、机抽运行井井数、机抽运行井产气。"
     ,"39"],
    ["措施增量汇总，老井综合治理检测，包含：计划措施井次、实际实施井次、计划措施增气量、实际措施增气量。"
     ,"40"],
    ["重点指标检测，包含：平均生产时率、措施有效率、躺井数、躺井率。"
     ,"41"],
    ["泡排井跟踪，泡排井实施分布，包含：井数、产量。"
     ,"42"],
    ["气举统计，包含：日均产气量、累计产气量、措施前日均产气、措施后日均产气、井数、月产量。"
     ,"43"],
    ["泡排泵撬台账，包含：分区泵数量、各厂家泵数量。"
     ,"44"],
    ["泡排总览，包含：泡排日度动态、加药井井数、加药井产气、运行井井数、运行井产气、新投井数、年增气量、措施有效率、平时生产时率、单井日均起泡剂加注量、\
    单井日均消泡剂加注量。"
     ,"45"],
    ["综合采气时率，包含：区块月度综合采气时率、气田月度综合采气时率。"
     ,"46"],
    ["水淹关停率，包含：非躺井数、躺井数。"
     ,"47"],
    ["油井管柱结构统计。"
     ,"48"],
    ["完井管柱下入角度"
     ,"49"],
    ["普通油管施工单位作业井数"
     ,"50"],
    ["油管完井井数统计，包含：不同规格油管累计完井井数统计、各年度油管完井井数统计。"
     ,"51"],
    ["年度管线穿孔次数，月度管线穿孔次数。"
     ,"52"],
    ["输差分析，包含：输差和输差标准线。"
     ,"53"],
    ["腐蚀穿孔，包含：各年腐蚀穿孔次数、各月腐蚀穿孔次数、集气站腐蚀穿孔次数、管线部位腐蚀穿孔次数、各集气站腐蚀穿孔次数。"
     ,"54"],
    ["某一个集气站的细菌检测，包含：腐生菌、硫酸盐还原菌、铁细菌。"
     ,"55"],
    ["药剂统计，缓蚀剂加注统计，起泡剂加注统计，消泡剂加注统计，包含：缓蚀剂加注井数、缓蚀剂加注量、起泡剂加注井数、起泡剂加注量、消泡剂加注井数、消泡剂加注量。"
     ,"56"],

]
# def main():
#     res = "|分类内容|分类编号|\n|---|---|\n"
#     for x in problem_classification:
#         res += "|" + "|".join(x) + "|\n"
#     return {
#         "result": res,
#     }

# import requests
# from datetime import datetime,timedelta
# def main(cookie: str):
#     try:
#         url = f"http://10.84.4.74/yyqer/dhc/rdcxqx_json.jsp"
#
#         response = requests.get(url, headers={"cookie": cookie})
#         in_data = response.json()["data"]
#         data1 = ""
#         data2 = ""
#         x_axis = ""
#         for x in in_data:
#             x_axis += x[0] + ","
#             data1 += x[1] + ","
#             data2 += x[2] + ","
#         data1 = data1[:-1]
#         data1 += ";"
#         data2 = data2[:-1]
#         x_axis = x_axis[:-1]
#         return {
#             "title": "日度产销曲线",
#             "yname": "产销量(万方)",
#             "lname": "日产气量,日销气量",
#             "data": data1 + data2,
#             "x_axis": x_axis
#         }
#     except Exception as e:
#         print(e)
#         return {
#             "result": "无法获取异常动态数据",
#         }

# now_date = datetime.now()
# pre_date = now_date - timedelta(days=3)
# srq = pre_date.strftime("%Y-%m-%d")
# erq = now_date.strftime("%Y-%m-%d")
from urllib.parse import quote
# from datetime import datetime,timedelta
# import requests
# def main(cookie: str):
#     now_date = datetime.now()
#     pre_date = now_date - timedelta(days=90)
#     srq = pre_date.strftime("%Y-%m-%d")
#     erq = now_date.strftime("%Y-%m-%d")
#     url = f"http://10.84.4.74/yyqer/cqgc/scfx/gx_yj_qx_json.jsp?srq={srq}&erq={erq}&yjmc=hsjjzl"
#     response = requests.get(url, headers={"cookie": cookie}, timeout=5)
#     in_data1 = response.json()["data1"]
#     x_axis1 = ",".join(in_data1[0])
#     data1 =  ",".join(in_data1[1]) + ";" + ",".join(in_data1[2])
#     url = f"http://10.84.4.74/yyqer/cqgc/scfx/gx_yj_qx_json.jsp?srq={srq}&erq={erq}&yjmc=qpjjzl"
#     response = requests.get(url, headers={"cookie": cookie}, timeout=5)
#     in_data2 = response.json()["data1"]
#     x_axis2 = ",".join(in_data2[0])
#     data2 = ",".join(in_data2[1]) + ";" + ",".join(in_data2[2])
#     url = f"http://10.84.4.74/yyqer/cqgc/scfx/gx_yj_qx_json.jsp?srq={srq}&erq={erq}&yjmc=xpjjzl"
#     response = requests.get(url, headers={"cookie": cookie}, timeout=5)
#     in_data3 = response.json()["data1"]
#     x_axis3 = ",".join(in_data3[0])
#     data3 = ",".join(in_data3[1]) + ";" + ",".join(in_data3[2])
#     return{
#         "title1": "缓蚀剂加注统计",
#         "yname1": "",
#         "lname1": "加注井数,加注量",
#         "data1": data1,
#         "x_axis1": x_axis1,
#         "title2": "起泡剂加注统计",
#         "yname2": "",
#         "lname2": "加注井数,加注量",
#         "data2": data2,
#         "x_axis2": x_axis2,
#         "title3": "消泡剂加注统计",
#         "yname3": "",
#         "lname3": "加注井数,加注量",
#         "data3": data3,
#         "x_axis3": x_axis3,
#     }
# import requests
# from datetime import datetime,timedelta
# def main(cookie: str,jh: str):
#     try:
#         date_now = datetime.now().strftime("%Y-%m-%d")
#         url = f"http://10.84.4.74/yyqer/scbb/r_rdbb_json.jsp?tz=&jhs={jh}&rq={date_now}"
#         response = requests.get(url, headers={"cookie": cookie},timeout=15)
#         return {
#             "result": response.text,
#         }
#         data = response.json()["data"]
#         res = f"{jh}生产日报如下：\n"
#         res = res + "|公司|区块|管理区|井号|中心站|井站|层位|生产井段m|开采方式|生产时间|套压Mpa|油压Mpa|井口气吗m3/日|放空气m3/日|水m3/日|油t/日|油m3/日|起泡剂kg|消泡剂kg|缓蚀杀菌剂kg|输压Mpa|温度|生产自用气m3|表套Mpa|技套Mpa|孔板mm|氯根mg|油嘴mm|投产日期|备注|\n"
#         res = res + "|---" * 30 + "|\n"
#         for x in data:
#             res = res + "|" + "|".join(["无" if item == "" else item for item in x]) + "|\n"
#         return {
#             "result": res[:3000],
#         }
#     except Exception as e:
#         return {
#             "result": "无法获取生产日报数据",
#         }
# import requests

# import requests
# from typing import Dict, Any, Optional
#
#
# def main(**kwargs) -> Dict[str, Any]:
#     """
#     发送聊天消息到指定API端点
#
#     Args:
#         **kwargs: 关键字参数，必须包含 'query' 字段
#
#     Returns:
#         Dict: 包含操作结果的结构化字典：
#             - success (bool): 操作是否成功
#             - data (Optional[Dict]): 成功时返回的API响应数据
#             - error (Optional[str]): 错误描述信息
#     """
#     # 配置参数（建议移至环境变量或配置文件中）
#     API_URL = "http://10.85.2.51/v1/chat-messages"
#     API_KEY = "Bearer app-NGdyMdxW0FQ3QBTaTVACUojg"
#     USER_ID = "user-0909"
#     RESPONSE_MODE = "blocking"
#     REQUEST_TIMEOUT = 60  # 单位：秒
#
#     try:
#         # ----------------------------
#         # 1. 参数验证
#         # ----------------------------
#         query = kwargs.get("query")
#
#         if not query or not isinstance(query, str):
#             return _error_response("缺少或无效参数: query 必须为非空字符串")
#
#         # ----------------------------
#         # 2. 请求配置
#         # ----------------------------
#         headers = {
#             "Authorization": API_KEY,
#             "Content-Type": "application/json"
#         }
#
#         payload = {
#             "inputs": {},
#             "query": query,
#             "response_mode": RESPONSE_MODE,
#             "user": USER_ID
#         }
#
#         # ----------------------------
#         # 3. 请求发送
#         # ----------------------------
#         try:
#             response = requests.post(
#                 url=API_URL,
#                 headers=headers,
#                 json=payload,
#                 timeout=REQUEST_TIMEOUT
#             )
#         except requests.exceptions.RequestException as e:
#             return _error_response(f"请求发送失败: {str(e)}")
#
#         # ----------------------------
#         # 4. 响应处理
#         # ----------------------------
#         if not response.ok:
#             return _http_error_response(response)
#
#         print(response.text)
#         try:
#             return _success_response(response.json())
#         except ValueError:
#             return _error_response("响应内容解析失败: 无效的JSON格式")
#
#     except Exception as e:
#         return _error_response(f"未预期的错误: {str(e)}")
#
#
# # ----------------------------
# # 工具函数
# # ----------------------------
# def _success_response(data: Dict) -> Dict[str, Any]:
#     """构建成功响应"""
#     return {
#         "success": True,
#         "data": data,
#         "error": None
#     }
#
#
# def _error_response(message: str) -> Dict[str, Any]:
#     """构建错误响应"""
#     return {
#         "success": False,
#         "data": None,
#         "error": message
#     }
#
#
# def _http_error_response(response: requests.Response) -> Dict[str, Any]:
#     """处理HTTP错误响应"""
#     error_msg = (f"HTTP错误 [{response.status_code}]: "
#                  f"{response.text.strip()[:200]}")  # 限制错误信息长度
#     return _error_response(error_msg)
#
# payload = "VnHk3AhgdIybTZ7wCEG0L02vLeTI7edPKe3b7e1b7edi7r2b20i0TWfY2rt0xRwdC98R21fN29gTqw7fN1xexfvc296S296S296sJfvc296S296S298n3Eulj9kSqWDwT0gTq06S298aTZhwT080Vxvc296S296S298DNfheEwfK2BhwTIKX2BfP2m85296S296SABFS296ShwHONxvc296S296S298Nx1pUCwg4ExyDNfheEwf9ABFS296SpIgwTZdSdRgfCkhjARxxd08Hdn8LNbGSNwxKNfvc298Tp1fLh98dGbHh2eiy21f1hfy7NRudCfKtdbwNh1fdhCiSJNKXABFS2fvRGdu12fhedw1SOrRS2fhCxduejf7DdRh8x1dYHbwfGx2MjC8Tq06S2988NkGSx17CdC6oOC6SdbwNh1fdhC8Tq0wTqw7fN1xex98TqwvRp9uiqC88dn8iqxvcAmGYp9ujC988dn8s4fvcAmGYp9ujGkbe21fN2BX0ABuTp9vRJwfJNdKSGxKSTE5Tq06S296YGRyLGRfdjmGcdd57GnvRJkX2jC88dn8v4IXtABFS296SJmGcdRgHCkhjARxxd088dn8P4ZxbTwvcAmGYp9uNCw2SGxKSTIXnVxvcAmGYp9uNCf2SGxKSTIgnVxvcAmGYp9uNhRhANdKSGxKSVEvkpbvcAmGYp9uDN1h421fN2mwYDmXTq06S296Yp9uDN1h4Ew8KC088dn8uqBhQpm8TqwvRJmGcEwH4Cwg721fN2mXnVZXTq06S296Yp9u4NfX3NC88dn8QqmXTq06S296YdkxGN1fehCgRJwgeEkg3NC6YHnoMJB7tT0SvK9kX21fN2mgrVZgTq06S296Yp9ueCww3Ewg721fN2mwYVAgTq06S296Yp9u3GRX1E1RSGxKSVB7sDfvc296S29vChx8KGd7fjmGcEkvjGbg7J9TaHnvr4m2tKN6XjC88dn8QqBXrABuTp9vRJwheN988dn8R3IvTqwvRJmGcxf7K21fN2mhPqfvcAmGYp9udEkiSGxKSpmXYABuTp9vCNbxLh9gRJk7DdbSYK0kSGxKS3WwPVfvcAmGYdkyxNkGtp9uJCfX9Ck3YK0kSGxKS4IgQ3wvcAmGYp9uDNfheEwfK21fN2mwYpB7QTEvTq06S296YCdDLxdvKjmGcGb7DN9iMJnTX21fN2B7PVEvTq06S296YCdDLxdvKjmGcGb7eN9iMJnTX21fN2B7P3IvTq06S296YGRfNhC8Tq06S298Tpfp2hdFSp9uiqC6o2eGSx1gfN06v2fvc296S2fvRxRgfN08RJM852eFSKn88NkGSp9uDNfheEwfK2eFyKC8dC1xL2eHTq06S298Tp1xKdRdSKbvc296S21xLh988dn80TbvchwHONC8R2fp2hxHf2e1yKC2Y2Z7bTMHwqMG0Lr1Y2M7XVZd0Lr1iJ9HaTZhwTkHu2rXzUCi0TBfn3EbP2rXcpEvYJ9Hr3E7tDC2QDZfYTIdY2Z7g3IgwxBw5DC2Q7r6iJ9HcqR7apEuR2rXZ3EvPDAR!"
# import requests
# def main(cookie: str):
#     url = "http://10.85.3.61:28078/dataview/data/getDVDataBySql"
#     response = requests.post(url,headers={"cookie": cookie,"Content-Type": "application/json;charset=UTF-8"},timeout=15,data=payload)
#     print(response.text)
# res = main("testCookie=true; JSESSIONID=650809B04C67EF0373099EDB44491982; jwt=eyJhbGciOiJIUzUxMiJ9.eyJ1c2VySWQiOjMxMzgwODY2NzYxNjg5MDk4LCJsb2dpbklkIjoxOTMxOTA4MzQ2NjcyMDU4MzY5LCJ1c2VybmFtZSI6ImxpdWMyMDI1IiwiaWF0IjoxNzQ5NDUwNjI1LCJleHAiOjE3NDk0NTI0MjV9.APQCYZ3woCtQBz6OpDXuxbKHF9mCzfWDQlhofpeNLUAxKU7nWSNeclOaEsiB6KZ0XWdalWJz5H-K-Jzfeeay6g")
# print(res)
from datetime import datetime
# def main() -> dict:
#     now = datetime.now().strftime("%Y年%m月%d日")
#     return {
#         "result": now,
#     }
# main()
#
# import requests
# from datetime import datetime,timedelta
# def main(cookie: str,jh: str):
#     try:
#         url = f"http://10.84.4.74/yyqer/idoc/cqgc/data/readjson1.5.1.jsp?jh={jh}"
#         response = requests.get(url, headers={"cookie": cookie},timeout=15)
#         return response.json()
#     except Exception as e:
#         return {
#             "result": f"无法获取数据{e}",
#         }
# import requests
# from datetime import datetime,timedelta
# import requests
# import math
# def main(cookie: str,jh: str):
#     try:
#         url = f"http://10.84.4.74/yyqer/jtbb/zjjcsj_json.jsp?jh={jh}"
#         response = requests.get(url, headers={"cookie": cookie},timeout=15)
#         data = response.json()["res"][0]
#         data1 = response.json()["res2"][0]
#         data2 = response.json()["res2"][1]
#
#         title = ["井号", "井别", "井型", "地理位置", "构造位置", "钻探目的", "井口复测坐标纵坐标", "井口复测坐标横坐标",
#                  "地面海拔(m)", "补心海拔(m)", "补心高(m)", "开钻日期", "施工队号", "完钻日期", "完钻井深(m)", "--",
#                  "完井日期", "完井方式", "人工井底(m)", "一开日期", "二开日期", "三开日期", "油套阻位(m)", "井口层位",
#                  "设计井深(m)", "完钻层位", "备注", "数据更新时间"]
#         res = f"{jh}的基础数据、详细信息如下：\n"
#         res = res + "|属性|数据|\n|--|--|\n"
#         for i, value in enumerate(data):
#             res = res + f"|{title[i]}|{value}|\n"
#         return {
#             "result": res[:3000],
#             "d0": data[0],
#             "d1": data[1],
#             "d2": data[2],
#             "d3": data[3],
#             "d4": data[4],
#             "d5": data[5],
#             "d6": data[6],
#             "d7": data[7],
#             "d8": data[8],
#             "d9": data[9],
#             "d10": data[10],
#             "d11": data[11],
#             "d12": data[12],
#             "d13": data[13],
#             "d14": data[14],
#             "d15": data[15],
#             "d16": data[16],
#             "d17": data[17],
#             "d18": data[18],
#             "d19": data[19],
#             "d20": data[20],
#             "d21": data[21],
#             "d22": data[22],
#             "d23": data[23],
#             "d24": data[24],
#             "d25": data[25],
#             "d26": data[26],
#             "d27": data[27],
#             "e0": data1[0],
#             "e1": data1[1],
#             "e2": data1[2],
#             "e3": data1[3],
#             "e4": data1[4],
#             "e5": data1[5],
#             "e6": data1[6],
#             "e7": data1[7],
#             "e8": data1[8],
#             "f0": data2[0],
#             "f1": data2[1],
#             "f2": data2[2],
#             "f3": data2[3],
#             "f4": data2[4],
#             "f5": data2[5],
#             "f6": data2[6],
#             "f7": data2[7],
#             "f8": data2[8],
#             "f9": str(math.sqrt((float(data1[4])-float(data2[4]))**2 + (float(data1[5])-float(data2[5]))**2))
#         }
#     except Exception as e:
#         return {
#             "result": f"无法获取基础数据、详细信息数据,{e}",
#         }
# res = main("userName=wlx2023.jhyt; password=; JSESSIONID=0EAB7853FAE119DDD77813F5B7A49C9D"
#            ,"焦页1-S1HF")
# print(res)


